should be setup and ready
for oVirt developers to test interface functionality via Selenium.
Interface tests can be added to the test/functional/interface_test.rb
module and will be picked up and executed automatically when ‘rake
test’ is run. Note if the ‘selenium.rb’ module is missing from
the ‘test/’ directory, the interface tests will _not_ be loaded.
Since this module cannot be added to the code base due to licensing
issues, the oVirt autobuild system is configured to automatically
pick it up from /var/selenium/selenium.rb (if present, else the
interface tests will be skipped as mentioned before) and copy it to
the oVirt test appliance.
These tests contact a Selenium test server, giving it the web-accessible location of the oVirt wui. Both the Selenium Server and oVirt wui locations can now be specified via the config/selenium.rb config file (pending one of my recent patches being committed). If you are running the tests via autobuild, or on an build-all.sh generated appliance whose host is running the Selenium server (remember to open the port), you don’t need to edit any of these values, as the fixed 192.168.50.x virtual network will be employed. If you have a different test setup, you will need to modify this configuration file to specify the location of the Selenium Server and the location of the oVirt wui server from Selenium’s perspective.
If your able to run ‘rake test’ without any errors after all this, then selenium is integrated, and you should be able to add your own tests. See the tests already there and pending ack on the list to see how to do this. Opening / closing the browser and navigating to the main page is already taken care of via the setup/teardown methods so that all that remains is to actual test the input / output of the oVirt interface.
Now that you can locate elements on a page, operating on them is trivial. You may use the Selenium ruby api http://release.openqa.org/selenium-remote-control/0.9.2/doc/ruby/ (Selenium also provides bindings for many other languages) to interface with the site. Some useful commands are:
wait_for_condition("selenium.isElementPresent(\"//div[ id='foobar']\")", 10000)
And thats about it, Selenium provides
many more methods to test the application than I describe here, but
this should give you a general idea of where to start. Hope this