Capturing Screenshots in Watir

Posted by Tim on June 2nd, 2008

Recently I noticed some discussion in the watir user group about trying to capture screenshots when running automated tests.

For such a simple requirement, it’s frustrating that solutions available either cost money (such as the purchase of SnagIt) or are a tad complicated in implementation requiring the installation of some out of date gems and dependencies. I’ve also come across this requirement in other automation tools such as QTP, so I thought it’s about time I rolled up my sleeves and hack together a simple solution with C#.NET 2.0.
Read more »

Using JDBC with LoadRunner Java Vusers

Posted by Tim on June 2nd, 2008

This is a short post on how to establish JDBC connectivity to a MySQL database when using the Java Vuser type within LoadRunner. Stuart describes a situation in which you might want to do this here. I’m not sure why but the example code is missing from his site, so I’ve supplemented with an example of how you’d implement this within LoadRunner.
Read more »

Performance Testing Flex Remoting (AMF) with JMeter

Posted by Tim on May 7th, 2008

[UPDATE] this has since been resolved! JMeter support rocks :D
URL: http://svn.apache.org/viewvc?rev=661141&view=rev
Log: Bugs 44808 & 39641 - Proxy support for binary requests

You may still find the ruby proxy idea interesting …

The Action Message Format (AMF) is a binary protocol that Flex applications use to remotely communicate with the server. I’ve tested recording of this using LoadRunner which picks up the binary format nicely as part of the HTTP POST.

It will look a little like this:

  web_custom_request("amf_3",
    "URL=http://host.under.test.com/messagebroker/amf",
    "Method=POST",
    "Resource=0",
    "RecContentType=application/x-amf",
    "Referer=http://ost.under.test.com/messagebroker/client/main.swf",
    "Snapshot=t13.inf",
    "Mode=HTML",
    "EncType=application/x-amf",
  "BodyBinary=\\x00\\x03\\x00\\x00\\x00\\x02\\x00\\x04null\\x00\\x02/3\\x00\\x00\\x01\\x0F\n\\x00\\x00\\x00\\x01\\x11\n\\x81\\x13Mflex.messaging.messages.CommandMessage\\x13operation\\x1BcorrelationId\tbody\\x13messageId\\x11clientId\\x15timeToLive\\x13timestamp\\x0Fheaders\\x17destination\\x04\\x08\\x06\\x01×06\r"
    "my-amf\\x01\\x06#labelPrintService",
    LAST);

I understand that Segue Silk Performer also has this capability to natively record binary protocols arbitrarily attached to the POST. Unfortunately the native JMeter proxy (when used for recording) doesn’t pick up this data reliably.

This defect is current being tracked at the ASF Bugzilla

After looking around for some proxying software that would assist, products such as Charles Proxy looked tempting. But to be honest, if you’re reading this and using JMeter, you’re probably not interested in paying any license fees.

Read on for a free alternative when using JMeter.
Read more »

Installing GD Libraries for Leopard Apache PHP 5.2.5

Posted by Tim on April 29th, 2008

Another post for my fading memory, how to install the GD libraries for your Leopard Apache installation running PHP 5.2.5. I will be using these libraries in a forthcoming blog about the use of ‘sparklines‘ to present complex performance monitoring data.

Now on with installation. Thanks to topicdesk for leading the way with detailed OSX 10.5.x server installation instructions. Here’s my own shorthand version …
Read more »

A Growl Hack to Remind You to Unplug Your Charger

Posted by Tim on April 24th, 2008

If you’ve been using a Macbook Pro or similar for some time, you’ll find that their batteries need tender love and care, if they are to go the distance. According to Apple, I fit into the ‘ideal use’ category as I regularly use my notebook on the 1+ hour daily train commute.

However as the recent purchase of a new $199AUD battery has taught me, I often neglect to ‘unplug’ from the charger when weaseling away at work.

ioreg is part of Apple’s I/O Kit Registry, which you can use to determine programatically what the remaining charge of your battery is based on current and max capacity. Using this tool and Growl notifications, I’ve written a quick hack to remind me to unplug whenever my battery charge is greater than 99%.
Battery Charge Growl Notification Trans
Read more »

Roll Your Own SiteScope, a Simple Alternative

Posted by Tim on April 23rd, 2008

In working with SiteScope of late, I’ve found that it doesn’t always collect performance metrics the way I want to. More importantly, it can often turn a simple monitoring activity into a complex disaster. Take monitoring via JMX for example. In SiteScope, it has a rather complicated (and sometimes broken) interface when trying to communicate with a busy MBean Server. One can quite easily roll your own JMX monitor using open source tools in about 65 lines of code as I demonstrated here.

But we still all use tools like LoadRunner in these commercial 9-5 contracts right? Wouldn’t it be nice, if you could roll your own custom monitors in Ruby, Perl or whatever language you like, store that data in a simple repository, let’s say a MySQL database, and still be able to hook into those metrics from a LoadRunner Controller during test execution!?

It is possible, with one PHP file and a simple WAMP (or LAMP) installation all wrapped up in a SiteScope-like alternative.
Read more »

A New Contractor Toy: USB to VGA

Posted by Tim on April 17th, 2008

Ever been on a client site and stuck with 1024 x 768?

I remember when even that was a dream, but after you get used to widescreen dual VGA in your own environment, weaning yourself off this can be a challenge. If you believe Microsoft research, dual screen users “never go back to a mono display” …

A friend and I bought a couple of these for $145AUD, to use in our day to day contracting work environment, where monitors are a plenty, but security (or warranty) forbids you from cracking open the case and installing a new video card.

The performance is a little sluggish, and sometimes the refresh goes a little awry, but all in all, it’s pretty handy to have around when debugging code. I wouldn’t recommend trying to play games on it, but definitely good to have in your toolkit.

Monitoring Weblogic 9.2 with JMX and JRuby

Posted by Tim on April 17th, 2008

After getting nowhere with lack luster HP support, I turned to the power of the Open Source community and got a very simple script up and running to remotely monitor Weblogic JVM Performance and JMS queues using JMX and JRuby.

Despite having some initial issues with the code, the author of the jmx4r module turned around a fix inside 24 hours so that I could connect to a Weblogic 9.2 server and look at its domainruntime MBeans. SiteScope can’t handle domainruntimes of these size (short of being told to ‘add more memory’ to a 3GB+ machine!). So exit stage left Mercury, enter stage right JRuby…
Read more »

Regex Pattern Matching in LoadRunner

Posted by Tim on April 17th, 2008

I quite literally stole this idea from Charlie at PerformanceEngineering in which he posted a response to a challenge by Dmitry on how to get regular expressions up and running within LoadRunner.

I’m a huge fan of regex, and thanks to these guys, now have a way of implementing at least pattern matching with LoadRunner. Ideally I’d like to be able to include pattern matching & replacing, like Ruby or Perl does in one line but for now am happy for pattern matching.

Read on for the changes I made to Charlies code to abstract matching functionality and call it as a function within other LoadRunner actions.
Read more »

Formatting Data for Import into LoadRunner Analysis

Posted by Tim on April 16th, 2008

HP LoadRunner Analysis is a free tool right? Well, maybe not “free, as in free beer”, but you can certainly install the trial version of LoadRunner 9.x, and Analysis does not appear to be time limited.

All right, I realise that the Controller is time limited, so how do you go about importing data into LoadRunner Analysis after your time trial has expired, and you can no longer use the Controller to ping away at your server resource metrics during runtime? Simply use the Import Data functionality built into Analysis…
Read more »

An Alternative for Mercury Virtual Table Server

Posted by Tim on April 3rd, 2008

Mercury’s Virtual Table Server (VTS) provides the following functionality when sharing data between vusers in your typical LoadRunner scenario …

Virtual Table Server (VTS) first edition, introduced the capability for LoadRunner virtual users, WinRunner and XRunner, to communicate in real time. Data extraction and communication was simplified but limited to column/queue level operations. The new Virtual Table Server II provides a higher degree of data manipulation and 5-10 times better performance. From row level queries, retrievals, updates, insertions, unqueue entries, to database access, VTS II provides the functionality and ease for enhanced inter-process, inter-virtual user communication

A useful tool in itself, but with some annoying limitations. MyLoadTest elaborates on this:

The API is simple, but unfortunately does not allow you to write SQL queries; instead you must use the functions provided, like lrvtc_retrieve_row() and lrvtc_query_row()…

Read on for an alternative when using web vusers in LoadRunner.
Read more »

Using LoadRunner Java Vusers with WebLogic JMS Queues/Topics

Posted by Tim on March 2nd, 2008

The following scripts are examples on how to generate load for the BEA WebLogic implementation of JMS. Specifically I demonstrate how to place messages on a queue and how to publish messages to a topic using a Java Vuser within LoadRunner.
Read more »

Monitoring Weblogic using JMX in SiteScope

Posted by Tim on February 28th, 2008

Using JMX (Java Management Extensions) it is possible to monitor Managed Beans published by MBean servers. Weblogic (WL) provides MBeans for both admin and managed servers.

You can find out more info about WebLogic MBeans and accessing them with JMX here

Following are some augmented instructions for setting up JMX monitors within SiteScope. I used this excellent article as a starting point.
Read more »

Speeding Up Script Development Time in LoadRunner

Posted by Tim on February 26th, 2008

If you’ve ever had to write lots of LoadRunner scripts you’ll probably be interested in this snippet of code. Imagine you’re in a situation where you need to produce many LoadRunner scripts each with multiple actions. Normally, once you’ve got all your custom correlations down pat (I hate correlation studio BTW) you will also have a ton of stock standard parameters that you need to find and replace within your scripts. You can do this manually in a point and click type fashion; you can even use VuGen’s clunky text editor (Ctrl-H) to search and replace text strings etc, but if you get sick of this approach, and you want to be more consistent / accurate in your parametization, try the following Perl script.
Read more »

Monitoring Typical User Transactions with Ruby and SiteScope

Posted by Tim on February 21st, 2008

A colleague asked me the other day if it was possible to setup a workstation with just LoadRunner installed and have it automatically carry out a typical user transaction to determine the ‘health’ of the target server. After explaining to him that it would be a clunky approach at best, and currently lacking an installation of HP’s Business Availability Center which could achieve such a thing (Bah, humbug to that) I suggested we write a simple Ruby script, using the ‘watir’ gem which can be periodically called by the existing SiteScope installation.

If you didn’t have SiteScope installed, you could just as easily run this script as a scheduled task within Windows or via cron within a Unix environment, no sweat …
Read more »

Monitoring Weblogic using JMX in LoadRunner

Posted by Tim on February 21st, 2008

When configuring the WebLogic (JMX) monitor (Add Measurements via the Run tab in Controller) you may be presented with the following error:

Java Virtual Machine Version mismatch: Required version: 1.3

To overcome this try the following steps …
Read more »

TextMate Alternative for Windows

Posted by Tim on February 19th, 2008

Well as you know, I’ve become a bit of a Mac zealot (thanks Ted) and strongly favour TextMate as my preferred editor for coding and scripting … Unfortunately, my real job is in a pure Windows environment, so if you’re after a hit of TextMate-like functionality, try Intype … It’s currently available as a free Alpha release, and is work looking at if you’re stuck on Windoze …

Intype is a powerful and intuitive code editor for Windows with lightning fast response. It is easily extensible and customizable, thanks in part to its support for scripting and native plug-ins. It makes development in any programming or scripting language quick and easy.

[Bump] MyThree Bandwidth Usage Widget

Posted by Tim on February 7th, 2008

Download it ‘ere…

I currently have a mobile broadband account (HSDPA) provided by three.com.au, and after a hexy surcharge from the previous month when exceeding my limit, thought it would be prudent to build a dashboard widget that tracks my monthly bandwidth usage.

Building on a previous post that automates calls to a https website, I followed a nifty tutorial here to turn that perl script into a Mac OSX dashboard widget. I have since revised my original code and opted for a Ruby version of the script, as I found Ruby is easier to setup for a noob as opposed to Perl and its dependencies …
Read more »

An exercise in correlation - playing MySpace music via iTunes

Posted by Tim on February 7th, 2008

[UPDATE] Mr Gecko, has since implemented this logic and sorted out downloading woes (for u US folk) in a nifty little OSX app here

In between contracts, I have been practicing the art of correlation by scraping data from public web sites. The legality of this is perhaps a little unclear so I’ve aimed not to infringe on copyrights by not storing the content, but just changing the way in which content is displayed from a live site. One such example was to open up MySpace songs via iTunes, rather than using the flash player MySpace provide. This required a fair analysis of web server to client traffic, in order to piece together the necessary conversation required to achieve all this via Perl …
itunes-myspace
Read more »

Using Selenium RC to automate your web based testing

Posted by Tim on December 31st, 2007

Selenium is an awesome free alternative to apps such as Quick Test Pro and the like, providing you with a browser based automation suite for web applications.

Selenium uses JavaScript and Iframes to embed a test automation engine in your browser. This technique should work with any JavaScript-enabled browser. Selenium Remote Control provides a Selenium Server, which can automatically start/stop/control any supported browser. It works by using Selenium Core, a pure-HTML+JS library that performs automated tasks in JavaScript.

In this demo, I’ve used Selenium-RC and Perl to automate the checking of a promotional website called FreeStuffDay where every month you can have the chance to secure an advertised item for free. Instead of me sitting behind a browser checking the availability of free items manually, I’ve written a quick demo script to show you how it’s done from Perl and Selenium-RC.
Read more »