Wednesday

ALM and BPTWrapperTest



Problem : Unable to run a few tests in ALM 11 that were executing before the upgrade

Solution: The reason is named “BPTWrapperTest” that takes a BPT test - downloads all its components - and generates a single QTP “BPT Wrapper” test to run.

Why?: BPT performance issues that were seen in QC10.
Issues: Mostly data related tests break when running BPT in ALM11.

Workaround: Disable this feature from the System Registry and modify the registry key value of UseBPTWrapperTest to ‘N’.

Here is the path of the registry key in Windows 7/ iSpace:
Win 7/ iSpace == HKEY_LOCAL_MACHINE >> SOFTWARE >> Wow6432Node >> Mercury Interactive >> Test Director >> BPT >> UseBPTWrapperTest

Dont like the workaround?:

Change Environment(“TestName”) to Environment(“ActionName”)

DataTable.Value(“test”) to DataTable.Value(“test”, Enviroment(“ActionName”))


Tip: The only reason you are not able to not find the BPT path in the registry is that you are not looking in the right place. Check for the 32/64 bit OS path

Patch that might help - QTP_00709

Monday

Intellection on managing automated tests with frequent releases / versioning



Problem: Group of products that are separate but related, and are periodically released (i.e. versioned).

What is required: Automated tests to run from the start of the suite against all different versions, meaning that the current state of our master test code branch should run meaningfully against arbitrary versions of the production builds.

Solutions:

1. Include version detection and an internal listing of features per build. Benefits here include making the test simpler because if the version list says feature X isn't part of it, the script never checks feature X, and the presence of a 'feature oracle'. Drawbacks are that it's more complex to implement and maintain, since the feature/version matrix has to be correct and up to date or you could have features not being tested (if the oracle says the feature is from a later version or is missing the feature entirely) or tests failing (if the oracle says the feature is from too early a version).


2. Build feature detection into your scripts instead: check for the existence of the link to feature X and act on it only if it exists. Advantages include - if the feature is there it will be tested, tests will never fail on trying to exercise a feature that doesn't exist. Disadvantages include - this will be slower because there will always be the necessary checking time to determine whether the feature exists, you won't know if a feature is missing from a version (unless you use both approaches, which of course gets you all the advantages and drawbacks of both).


3. What you should eulogize to the dev team:

•Use predictable element IDs in your UI so that tests are less reliant on the DOM layout.

•Design your pages using reusable components so that the page design is more consistent; this reduces the number of patterns the test needs to understand.
•Get your UI developers involved in the test design so that everyone understands the impact of changes

And then what the automation engineers should do is:

•Take advantage of element IDs when they are available (and when they are consistent; dynamic element IDs are not particularly useful to a tester).

•Structure your tests to take advantage of page design patterns.
•Allow your tests to be aware of what product version they are running against, and tag your tests with version information.
•Consider negotiating the number of production versions you intend to support. Perhaps there is some middle ground between compatibility with only the latest code and compatibility with arbitrary versions.
•Consider how much of test suite needs to remain compatible. Some tests may be more crucial than others; it may be enough to commit to compatibility for only a subset of the full test suite

Ideated from: http://sqa.stackexchange.com/

Thursday

Useful Firefox add ons for Software Testing



I have recently been testing a lot on firefox  and that led me to find a few Add-On's which can make our testing smarter and faster!

After exploring further here is a list in no particular order , just depends on what your intent of testing is:

1. YSlow with FireBug: YSlow gives the no of page components for a particular page with Response time for each. It also gives grading and summary of what things are required for good performance.


2. Tamper Data: Used for web security/penetration testing. Install this feature and tamper the data/request/cookies being sent to the server. Check for client side and server side validation.You can security test web applications by modifying POST parameters.


3. SQL Inject Me: SQL Inject Me is used to test for SQL Injection vulnerabilities. The tool works by submitting your HTML forms and substituting the form value with strings that are representative of an SQL Injection attack. The tool sends database escape strings through the form fields. It then looks for database error messages that are output into the rendered HTML of the page.

4. Groundspeed : Groundspeed allows input validation testing from the top-down, starting at the web application interface level instead from the HTTP protocol.
Some of the practical uses of groundspeed include changing hidden fields, select drop down lists and other fields into text fields, removing size and length limitations on input fields and modifying JavaScript event handlers to bypass client side validation without actually removing it.

5. iMacros :iMacros can be used for Automating, for checking and for security testing and to create load on a web server, for the purpose of load testing.
Record the actions of a webpage and run it in loops for creating users, subscribing for newsletters, adding friends, sending invites and other actions that you want to perform on a daily basis like firing up all the bookmarked webpage’s

6. Web Developer :You can check what is inside the forms without reading the source, modify form content easily etc. It also shows different kind of information about page, and you can disable e.g. cache from drop down menu.

7. XSS Me :  Cross-Site Scripting (XSS) is a common flaw found in today's web applications. XSS flaws can cause serious damage to a web application. Detecting XSS vulnerabilities early in the development process will help protect a web application from unnecessary flaws

8. Mustat: it is analytic tool that gives information regarding the domain in terms of IP address, No of servers, visits/day/week/month, SEO performance , traffic, page rank etc

9. Regular Expression Tester : This small add-on allows you to test your regular expression. The tool includes options like case sensitive, global and multiline search, color highlighting of found expressions and of special characters, a replacement function incl. backreferences, auto-closing of brackets, testing while writing and saving and managing of expressions

10. Flash Switcher : If you are involved in testing Flash Applications, than this little add-on is extremely useful to test your flash application on various versions of flash players.


11. HttpFox : This add-on is an amazing tool if you want to dig deeper into http request / response and analyze all the traffic. Using this add-on, you can get information about request / response header, sent and received cookies, Querystring parameters, POST parameters and Response body.


12. LinkChecker : This is a very simple tool to check if there are any broken links on the web page. It highlights all the links in various colors to show if they are broken or not

13. View Dependencies : This is an extremely useful add-on if you want to figure out what are all the files / images etc. are getting downloaded for every page, how much time they are taking and many such details

14. Page Speed: It is a Firebug-integrated FireFox extension recently open-sourced by Google. Page Speed is designed to analyze website performance and offer suggestions on how to improve page load times.

Thats about it , there are many more but these were the best of what I thought there were.
While doing some research I found two really good mindmaps from Moolya:

Firefox Add-ons : http://moolya.com/blog/wp-content/uploads/2011/03/Firefox-Add-ons-Compiled-and-Used-by-Testers-at-Moolya.png

Chrome Add-ons: http://moolya.com/blog/wp-content/uploads/2011/03/Chrome-add-ons-Compiled-and-Used-by-Testers-at-Moolya.png

Happy Coding!

QTP incompatible with Eclipse or any similar Java Application




There are more than a few reasons that you want both QTP and eclipse on your machine.

REASON: This is an issue with QTP, which adds some Java hooks globally, this breaks Eclipse at start time. Removing these will break QTP
When QTP is installed it creates/modifies several environment variables that Java applications use.

The setting for these values that are needed for QTP may cause problems for other Java applications, such as Eclipse.

There are scenarios where QuickTest Professional (QTP) java support environment variables (_JAVA_OPTIONS, JAVA_TOOL_OPTIONS, IBM_JAVA_OPTIONS, _classload_hook) prevent specific applications from launching or functioning properly.


SOLUTION:There are some suggested workarounds from HP in the following support doc: (http://support.openview.hp.com/selfsolve/document/KM834284).
Suggestion three is worth trying and does not require updating HKLM registry.


These suggestions will allow to work around this situation even with the QTP java support variables in place and with corresponding values. Note that the conflicting application will not be recognized in a java context because it is being excluded from the java support mechanism.

Create a batch file (.bat) to start the conflicting java application similar as follows:

@echo off

Set _JAVA_OPTIONS=

Set JAVA_TOOL_OPTIONS=

Set IBM_JAVA_OPTIONS=



This approach will disable the java environment variables for the run session of the .bat file

@echo off

Set _JAVA_OPTIONS=-Xrunjvmhook -Xbootclasspath/a:C:\PROGRA~2\HP\QUICKT~1\bin\JAVA_S~1\classes\jasmine.jar

Set JAVA_TOOL_OPTIONS=-agentlib:jvmhook

Set IBM_JAVA_OPTIONS=-Xrunjvmhook -Xbootclasspath/a:C:\PROGRA~2\HP\QUICKT~1\bin\JAVA_S~1\classes;C:\PROGRA~2\HP\QUICKT~1\bin\JAVA_S~1\classes\jasmine.jar




Source: HP Support forums.


Monday

Skillset - Firefox OS Test Automation Engineer



Note: the Skillset category is just to gauge where you stand in terms of the skills required for the role



The Mozilla test automation infrastructure runs hundreds of thousands of  tests on every code push. And we have hundreds of pushes a day. Our infrastructure tests everything from performance to rendering
correctness to platform robustness. We are expanding that infrastructure for Firefox OS, which involves porting existing harnesses, creating new ones, adapting infrastructure to work with the
new platform, debugging and triaging failures, and striving to meet the test automation needs of a dynamic and growing development organization.

As part of the Automation & Tools team, your work will involve crafting and troubleshooting the next generation of test automation for our Firefox OS product. This includes Marionette, our  WebDriver-inspired remote test driver. Your responsibilities will include adding new features to Marionette, debugging Marionette-related issues, and developing new ways to leverage this and other tools in test automation for Firefox OS. In addition to that, you'll be involved with developing methods to run our automation at very large scale, and debugging problems related to having that infrastructure operate in a very sizable and distributed fashion. You'll be working with automation involving Firefox OS emulators, real hardware, reference boards, and desktop simulators. You'll also be working with the entire automation team to improve our existing test frameworks, porting them to Firefox OS where appropriate, developing new test harnesses, and debugging automation failures of all kinds.

Our job number one is to save core Mozilla Development and QA teams' time by giving them the information they need and automation they can depend on.

Our ideal candidate will have:

* Superb Python skills (including low-level python: c-types, sockets, threading etc)

* Great JavaScript experience, perhaps with Mozilla extensions or Node.js

* Proven work in designing and implementing test and/or build automation and related tools

* Incredible debugging expertise with a track record of successfully debugging application and OS level issues

* Experience and familiarity with mobile operating systems/constraints such as Android, Windows Mobile, and/or iOS

* Stellar intra- and extra-team communication skills

* A passion for learning new things, and the adapability to be effective in a fast-moving environment


We'd also like to see:

* Selenium WebDriver experience

* Demonstrable C/C++ (or some relevant low-level) coding expertise

* Web Technology and Web Programming knowledge

* Make experience

* Open Source Involvement

Tuesday

Unable to close modal dialog webdriver - org.openqa.selenium.unhandledalertexception modal dialog present



There are times when you are not able to close a simple modal dialog in IE/Firefox
Mostly an error stating "org.openqa.selenium.unhandledalertexception modal dialog present"

Solutions:

These might not work:

Alert alerts = driver.switchTo().alert();

alerts.accept()
alerts.dismiss()
Since this works only for alerts.

driver.switchTo().window()

this method to a window with know name.

Alternative:


Actions action = new Actions(driver);
action.sendKeys(Keys.ESCAPE);

  
These might work:

"webdriver.getwindowHandles()" - to obtain a list of know windows. you may pass the handle to
"switchto().window()"

windowids = driver.getWindowHandles();

iter= windowids.iterator();
String mainWindowId=iter.next();
String popupWindowId=iter.next();
driver.switchTo().window(popupwindowid);


Alternative:

String mainhndl = driver.getWindowHandle();

//Code that brings up the popup
Set handles = driver.getWindowHandles();

for(String handle: handles)
{
  If(!mainhndl.equals(handle))
  {
     WebDriver popup = driver.switchTo().window(handle);
      popup.close();
  }
}



Monday

XPATH for IE / internet explorer



How to get XPATH for Internet explorer?
Alternate for firebug in Internet explorer?

If you are using selenium and your application works only on Internet explorer , the biggest challenge that one faces is to get the XPATH and validate the same, here is a neat workaround that uses javascript injection to get you the desired xpath:

  • Open IE in a new browser with a blank page
  • Add a new Favorites and name it XPATH1
  • Open the Favorites menu and right click the newly added favorite and select properties option.
  • Select the web Document Tab. Enter the following in the URL field:
javascript:function getNode(node){var nodeExpr=node.tagName;if(!nodeExpr)return null;if(node.id!=''){nodeExpr+="[@id='"+node.id+"']";return "/"+nodeExpr;}var rank=1;var ps=node.previousSibling;while(ps){if(ps.tagName==node.tagName){rank++;}ps=ps.previousSibling;}if(rank>1){nodeExpr+='['+rank+']';}else{var ns=node.nextSibling;while(ns){if(ns.tagName==node.tagName){nodeExpr+='[1]';break;}ns=ns.nextSibling;}}return nodeExpr;}

  • Click YES on the pop-up alert.
  • Add another favorite XPATH2
  • Open the Favorites menu and right click the newly added favorite and select properties option.
  • Select the web Document Tab. Enter the following in the URL field:
javascript:function o__o(){var currentNode=document.selection.createRange().parentElement();var path=[];while(currentNode){var pe=getNode(currentNode);if(pe){path.push(pe);if(pe.indexOf('@id')!=-1)break;}currentNode=currentNode.parentNode;}var xpath="/"+path.reverse().join('/');clipboardData.setData("Text", xpath);}o__o();

  • Click YES on the pop-up alert.

You are now ready to fetch the xpath:
  • Open your application in a new IE browser
  • Select (from the left of the object highlight until the right) whose XPATH you want.
  • Now first select the favorite XPATH1 and then select the favorite XPATH2
  • If you get a pop-up alert allow access.
  • Open any text editor and paste  - You will have the desired XPATH !
Enjoy this amazing trick done by js for getting the xpath of any object in Internet explorer.