I’ve defected from blogger.com, so far I’m impressed. Categories, stats, lots of nice skins and the import feature just saved me a boat load of time!
It’s taken about a day but I’ve managed to get some functional tests running using Watir. It’s not been as easy as it could have been mainly due to the way the SAP Enterprise Portal uses iFrames and the anti cross site scripting in Internet Explorer. I got there in the end though! I can now logon to the portal and functionally test iViews using a fairly simple Watir (Ruby) script:
def logon $ie.goto($html_root) if $ie.contains_text("Log Off") logoff() end $ie.text_field(:id, 'logonuidfield').set($user_id) $ie.text_field(:id, 'logonpassfield').set($password) $ie.button(:name, 'uidPasswordLogon').click end
A couple of things to note:
Talk to the iView directly
Due to the use of iFrames and IE anti cross site scripting accessing an iView which is embedded in a portal page is not possible with the current (1.4.1) version of Watir. Simply get the url of the iView and access it directly.
Problem with HTMLB Text Fields
ID’s and Names of HTMLB Text Field controls appear to be generated on execution, so I had to write a little script which would find a text field using the title property:
def find_text_field_by_title(my_title) found_text_field = nil $ie.text_fields.each do |tf| if tf.title == my_title then found_text_field = tf break end end raise "No text field found with title = " + my_title if found_text_field.nil? return found_text_field end
NOTE: I’m sure my Ruby/Watir scripts leave a lot to be desired, I don’t really know who to code in Ruby but they do seem to work!
Having trouble finding help on Watir?
Try the following in google:
site:rubyforge.org "[Wtr-general]" your search
The install should be as simple as dropping into dos, cd to your Ruby folder and run the command:
gem install watir
Unfortunately it wasn’t that simple for me, we work via a proxy here so I had to tell the gem utility about it.
Running gem install when you are behind a proxy
Set the HTTP_PROXY environment variable.
You can now run:
gem install watir
Or you can pass the proxy information as a parameter to gem via the -p switch:
gem install watir -p http://mycache:8080
Gem will now go off download and install the latest Watir package, version 1.4.1 in my case. Be patient this can take some time depending on server load.
I am hoping to use this software to test my web developments, from what I have read it looks very promising.
“WATIR stands for “Web Application Testing in Ruby”. Watir
is a free, open-source functional testing tool for
automating browser-based tests of web applications. It is pronounced water.”
Using the Ruby One-Click installer for windows (version ruby182-15.exe), just run standard install accepting all defaults.
NOTE: I tried the final version of Ruby 182-14 and had lots of install problems so use at least version 182-15!
Using the Watir One-Click installer for windows (version watir-1.4.1.exe), just run standard install accepting all defaults.
Now onto learning what can be done with this thing…
So you’ve accidentally uploaded a PAR file to the portal eh?
Here’s how to get rid…
(Top Menu) Java Development -> (Left Sub Menu) Tools -> Portal Archive Deployer&Remover
(Main Page) Archive Remover
Select the PAR file you wish to remove from the drop down list and click the “Clean” button
You should now see a message along the lines of:
INFO: Received clean-up request for application: “MyApp”
INFO: MyApp has been successfully removed from the PCD.
The PAR is no more.
To find your PAR files once they are uploaded to the portal:
(Top Menu) Java Development -> (Left Sub Menu) Tools -> Portal Support Desk
(Main Page) Portal Runtime -> (Main Page) Browse Deployment
Now move to:
You should now see a BIG list of files.
This is where your PAR files live!