OFBiz SeleniumXml This is a short document to help you get started using SeleniumXml to test your OFBiz
application. Here is a copy of the presentation that was given at the ApacheCon2008 OFBiz Conference
that describes more about the project. Installing SeleniumXmlFrom the ofbiz directory run the following ant command to download the
needed selenium- server.jar file.ant download-seleniumant run-install-extseed (For run install help data and example
test)Build the source by running "ant" in the testtools directory or your
OFBIZ_HOMEYou should now have everything you need to run a seleniumXml test.Running the Example TestSeleniumXml requires the selenium server to be running. The selenium server uses a
default proxy port of 4444. The default port can be changed when you start the server.
Selenium tries to automatically change the proxy settings in the testing browser. If you
are getting communication errors with the server you may have to manually change your
proxy settings in your browser.1. Start ofbiz as normal.Note: Before run ofbiz with selenium should changes ofbiz to use HTTP as the
default at file (framework/webapp/config/url.properties) . Instead everything just
works through port 8080. Selenium supports https but it is more complicated so for
this introduction I have turned https off.2. Start the selenium server:runSeleniumServer.bat / runSeleniumServer.sh 3. Change the configuration for your preferred browser in the
testtools/config/seleniumxml.properties file. The default is firefox (e.g.
browser=*firefox) but you can change it to any of the selenium supported
browsers.
Selenium
supported browsers you can find here
4. Run the Example test4.1 run the Example test .bat/.sh filerunSeleniumXml.bat / runSeleniumXml.sh
testdef/seleniumxml/example/example_testsuite.xmlThe above test combines three different tests into a single test suite. Data
is passed from one test to another to allow you to share generated data.You will get an assertion (or other exception) if the test fails.The test uses a .5 second delay for demo purposes. (see example_testsuite.xml
and the setSpeed value="500" command). You can remove this at the start of the
test if you don't want the delay- Here are some screen shots of what you should be seeing.4.2 run the Example test webtools/Run Selenium First you need to open the file example_testsuite.xml and comment out first
part.. and enable the bottom one Here is another way to run the selenium test
suite and you can create new test suite for your web application. Scroll up on
this page then you will see the link "Run Selenium" next to "Selenium Intro"
click on that link. On that page you will see the list of available test suites.
So you can click on "Run" to run the test suite you want but please remember
that the Selenium server should be started before you "run" any test. You can
also create new test suite by fill in the information to the form and put the
directory location of your test suite in the field "Test Suite Path" then
submit. If you want to know how the test is created you can take a look at the
file example_testsuite.xml for more info. Creating New Tests :The easiest way to create a new test is to use the Selenium IDE plugin for Firefox.
This allows you to records your own Selenium tests. You can then save the test and
convert it to a seleniumXml test easily.Install the latest
pluginRecord your steps as you run through your ofbiz application.Then convert the saved XML file using the convertSeleniumIDE.bat
script.For example:convertSeleniumIDE.bat
testdef/seleniumxml/example/recorded/AjaxExample.html
testdef/seleniumxml/example/recorded/AjaxExample.xmlManually modify the commands to suit your needs.