How to test Ontohub

From Ontohub
Jump to: navigation, search

If you want to test Ontohub, you can use Selenium (to be exact the Selenium IDE Plugin for Firefox) and the Ontohub test platform. This site is in an similiar status like Ontohub, but it has a few test data for you to play with. May you want to check on some infos about Selenium and Cucumber before you test our site.

With Selenium you can record test on and translate them with this gem called featurecorder for us developer. In the readme (featurecorder) you'll find instructions what to install and how to test Ontohub. You'll find these instructions also below.

Installation and Configuration

The translation gem feaeturecorder is not hosted on, so to install it you need to download it from here and run bundle and rake install.

What you need to do next is to install Mozilla Firefox (currently version 39.0), if you haven't yet. After that you need to install the Firefox plugins 'Selenium IDE' (currently version 2.9.0), 'Selenium XML Formatter' (currently version 1.5.1), which allows you to export the recorded test as XML, and 'Selenium IDE Button'(currently version to start Selenium with an easy button click next to your address bar in Firefox.

After that you need to change some options in Selenium. Start Selenium and click on Options -> Options. In the opened window you select the tab 'Locator Builders'. These handle the locators to find your selected elements in your tests. With drag & drop you can arrange the locators like this:


Now Selenium will record the elements with the ID, not the css selector because that could be unexcact.


So let's record some tests. Please check in the Ontohub project that the test you want to record doesn't exist already. Also notice, that Selenium will record every input as plaintext, so create a new account with a different password on Start Selenium, go to and click the record button. Everything you interact with the site now will be recorded. With a right click you can add commands like assertText or verifyTitle so check, if a expected element is present. Please just use the assert* and verify* commands, because the other ones aren't supported. If you're done just click the record button again and the record will stop. Now you can export the test as XML via File -> Export Test Case As... -> XML Formatter.


Now you can translate your recorded XML tests to Cucumber. With featurecorder -h you can see the options of this gem.

 featurecorder [options] <file>
 -s --scenario-name=<scenario>   Name of the scenario.
 -f --feature-name=<feature>     Name of the feature.
 -o --output-directory=<dir>     Output directory for generated files.
                                 Default is current directory.
 -h --help                       Show this screen.

With the option -s/--scenario-name you can choose the name for the scenario, with -f/--feature-name the name for the feature. -o/--output-directory lets you decide where you want to save the generated files for Cucumber. If you call featurecorder you need to state the XML file. If you're ready, fork the Ontohub project and you can post the files in a pull request.