Still Life

A Series of Mental Snapshots

Archive for July, 2008

Adding a Windows XP VM to ESX 3

Posted by Steve on July 23, 2008

I have encountered another little issue with ESX 3, you cannot straight add a Windows XP VM. I tried to Add the VM as I would any other VM, click add VM, follow the wizard steps, attach the Windows ISO and boot up. Unfortunately this causes an error with XP; during the bootup the Windows setup cannot find any Hard Drive. Then when you try to boot again, it boots to a blank screen, and the VM is dead.

This is actually a known issue with ESX, there are, unfortunately, a few extra steps you have to follow when adding a WinXP machine.
– Select custom, instead of typical, when you add the VM
– For I/O Adapter select Bus Logic (instead of LSI)
– When booting up the VM you MUST press F6 when the first blue setup screen shows up (if you don’t you have to create the VM again!)
– When prompted to, connect the floppy that is located in /vmimages/floppies
– Click through and proceed like you would a normal install

That is the work around, not too bad, but it would be nice to have known this going in! There is also a quite detailed explanation of this over at the vmware site: http://kb.vmware.com/selfservice/search.do?cmd=displayKC&docType=kc&externalId=1000863&sliceId=1&docTypeID=DT_KB_1_1&dialogID=17352968&stateId=1%200%2017356472

–Steve

Posted in Uncategorized, VMware | Tagged: , , , , , , | Leave a Comment »

Watir: Dealing with JavaScript and Frames

Posted by Steve on July 22, 2008

I came across this difficulty when I was trying to automate a webpage that was primarily built in Javascript; this webpage also always had the same href (or web address) and also was built with many frames.  The problem that I ran into was that I could find the links with the IE developer toolbar to get their ids, but whenever I tried to access them, I could not, I was given an error message saying that they did not exist. At this point in time I thought the issue I had was with javascript, but I was incorrect!

A lot of hunting on the interwebs led me, ironically, back to the watir main documentation, where I discovered that my issue was really with frames! When a website has frames, you need to specify what frame the link is in to actually access it, for example:
ie.frame(“main”).link(:id,”UW_CO_JOBTITLE_HL$”).click

Or in general terms:
ie.frame(“FRAMENAME”).link(:id, “LINKID”).click

And there we have, you can now access links that are in frames, hopefully this saves someone all of the hunting that I had to do! This is also a really good example of how difficult it is to find a solution to something when you are not sure what the problem was; I thought the problem was with JavaScript, so I was searching for that, but it was in fact as stated above with the frames!

–Steve

Posted in IE Automation/Watir/Ruby | Tagged: , , , , , , , | 2 Comments »

Driving IE With Watir and Ruby – An Automation Adventure

Posted by Steve on July 14, 2008

In my current employment I will be building an automation framework for a web application that we have. The front door approach to this is to simulate a user, this means the need of a way to drive Internet Explorer. This is where Watir comes in.

I figured I could not explain watir as succinctly as those who developed it, therefore here is a little blurb from the ruby web page (http://wtr.rubyforge.org/):

Watir is a simple open-source library for automating web browsers. It allows you to write tests that are easy to read and easy to maintain. It is optimized for simplicity and flexibility.

Watir drives browsers the same way people do. It clicks links, fills in forms, presses buttons. Watir also checks results, such as whether expected text appears on the page.

Watir is a Ruby library that works with Internet Explorer on Windows. Watir is currently being ported to support Firefox and Safari.

Like other programming languages, Ruby gives you the power to connect to databases, read data files, export XML and structure your code into reusable libraries. Unlike other programing languages, Ruby is concise and often a joy to read.

Watir stands for “Web Application Testing in Ruby”. It is pronounced water.

So there you have Watir is the exact tool that I will be needing. The first thing to get up and running is to install ruby, which is easily done from the ruby home page. Once ruby is installed, the Watir ‘gem’ can be installed form a command line prompt by typing: “gem install watir” . You will get a prompt at the end telling you that the install was succesful. You will need one final tool,the internet developer tool bar. This is a tool bar that gets installed in IE that allows you to inspect almost every element on a web page, this is not only useful but close to necessary for the scripting work.

Alright, ruby and watir are in and we’re ready to go. There are two ways to get going, an interactive way and a scripting way. The interactive ruby can be started from the command line by entering: irb . The second way is by  creating a *.rb file and then running that file from the command line by entering: ruby *.rb . I personally find that I use the irb interactive form to test things, which I then put into the *.rb scripts.

Below is a very simple watir script that will open an IE browser, navigate to google, click a link and then close the browser:

require ‘watir’

ie = Watir::IE.new
ie.goto(“www.google.ca”)
ie.button(:name, “btnG”).click
ie.close

The first line tells ruby that we are using the watir gem. We then set a variable, ie, to a new instance of an internet explorer browser the .goto command then navigates to a given web page. The syntax for manipulating an element on a page is as follows, ie.ElementType(:Attribute, ValueOfAttribute).action . Finally ie.close, closes the browser. This may seem a little confusing at first, but there of course is a good cheat sheet and that is located here: http://pettichord.com/watirtutorial/docs/watir_cheat_sheet/WTR/Cheat%20Sheet.html

There we have it, a brief introduction to watir, enough to get you up and going. I will be posting more as I learn, I have a few things to back post as I have already begun my automation framework. If you have any questions about ruby/watir, feel free to ask and I will do my best to help you out.

–Steve

Was this quick tutorial useful? Is there anyway that I could improve the way the information is presented? If so I’d love to know, drop me a comment and I’ll try to incorporated it into future posts!

Posted in IE Automation/Watir/Ruby | Tagged: , , , , , , , , , | 1 Comment »

A Personal Experience on the Difficulties of Giving and Accepting Advice

Posted by Steve on July 14, 2008

So it has been a little since I posted a good ‘thinker’ of a post but luckily for those of you have been just dying to read one, here we go. This post has actually been with me for a few weeks now, it is a continuation, in the form of a personal example, of why it is SO difficult to give advice. I am going to layout the events of what happened, then I will go into what I was thinking and feeling during the conversation in the following paragraph.

I was at the gym doing dead lifts, possibly one of the more difficult exercises to self monitor as far as form goes. I guess when I was doing the exercise my form was a little off, and with the amount of weight I was doing, it could have possibly gone poorly. So this was when one of the personal trainers who works at the gym comes up to me and says something to the effect of “Hey man, now I don’t mean to intrude or anything, but I think you need to focus a little more on your form.” I tell him that I was unaware that my form was off, he goes on to explain how I should be doing (like I don’t know), he also acknowledges that I am pushing a lot of weight, and that he does not want to diminish that fact. I simply say yes thank you, I will keep closer look in the future. He must have picked up on the fact that I wasn’t listening that closely because he kept going on about the dangers of not doing the exercise properly, and that if I focused on form, I would get the same benefits with less weight. I concluded the conversation by saying thank you and that I would make sure to try that next time.

So during this whole conversation, I was very very defensive, I acknowledged the fact that I probably did have bad form for the last few reps, and then thats all I wanted to hear. I stopped listening about 5 seconds into the conversation, and kept getting more and more agitated as he kept pushing at it; I was even aware that I was doing it, but that didnt matter! The most interesting thing is that I felt that way despite the fact that he did almost everything right:

He apologized for interrupting me,
He was in a position to know better (he is a personal trainer)
He tried to stroke the ego by mentioning the weight I was pushing
He provided reasoning behind why I should focus on form and how it wouldn’t effect my workout

He did almost everything right, yet I was still not receptive to anything he really had to say. This to me was very interesting, especially since I was aware of what was happening when he was telling me this. I then did some introspection, and I did find what it was that I took exception to, and it did have nothing to do with the personal trainer guy, it had to do with me, I don’t like to be wrong, even if I may be aware of it. I was proud of the weight I was doing, and then he came that I was doing it wrong, I was the wrong and in a public setting to boot. If this had been a private one on one training sessions and he had said I needed a little correction that would have been fine, but he pointed out that I was wrong in front of many people.

This was an interesting experience for me, because it demonstrated that there are times when you can do everything “right” but still not get the result you desire, even if you have the best intentions. The trainer guy just wanted to help me out, but I was having none of it, despite the fact he approached the situation almost perfectly. I would love to here other personal examples of when you got defensive when receiving advice or you noticed someone that was being difficult when you were giving advice because I find this topic very interesting, and every bit of experiential information helps to put this, sorry for the lame analogy, puzzle together.

–Steve

Posted in People Problems, Work: General | Tagged: , , , , , , | 3 Comments »

Creating specific files in windows with fsutil

Posted by Steve on July 10, 2008

This post comes from a recent issue I had recently, that was actually solved very easily with a built in windows tool. While running a test scenario, I needed to fill up a 20 GB disk. I have had to do with before, and it is pretty simple to do, you just grab some large files a copy them over and over again. I will never be doing that again thanks to a fancy little tool, fsutil.

fsutil is a built in windows program that has a whole bevy of options. You can open up a command line window and type fsutil to get the following options:

—- Commands Supported —-
behavior Control file system behavior
dirty Manage volume dirty bit
file File specific commands
fsinfo File system information
hardlink Hardlink management
objectid Object ID management
quota Quota management
reparsepoint Reparse point management
sparse Sparse file control
usn USN management
volume Volume management

From here you can get more details about any of the above features by entering fsutil “Feature Name”. So to create the large file we want to see the file options but entering fsutil file. Typing this in the command window gives the following output:

—- FILE Commands Supported —-
findbysid Find a file by security identifier
queryallocranges Query the allocated ranges for a file
setshortname Set the short name for a file
setvaliddata Set the valid data length for a file
setzerodata Set the zero data for a file
createnew Creates a new file of a specified size

So to create the large file, you need to use the createnew. So you can type in fsutil file createnew to see the usage as well as an example!

Usage : fsutil file createnew <filename> <length>
Eg : fsutil file createnew C:\testfile.txt 1000

It is important to note that the length, actually is the length in bytes, so a value of 1000, will be 1KB. There we are, any file of any size can be created. I foresee using this many times in the future, I also see exploring the fsutil feature much more, as it seems like a useful tool.

–Steve

Was this post useful? Could I improve on the layout of how I present these quick little tutorials? If so leave me a line, and let me know, I would love some feedback!

Posted in Testing, Tools | Tagged: , , , , , , , , , | 4 Comments »