Moby UnitTesting Panel

This panel allows to provide unit tests for any Biomoby service.

First, select a service you wish to provide a test for from the service tree. It will populate the Service Input Data table on the left with the definition of data for the selected service.

The Moby Unit Test Cases subpanel on the bottom right of the main panel allows you to provide one or all of the following items: a regular expression that matches the selected services' output, an XPATH expression, when applied to the selected services' output returns some matching nodes, or a sample service output that when compared, on a content basis, to the selected services' output is an exact match.

How to create input data

There are two ways to prepare data for a service call: using the Service Input Data table, or having them already in an XML format expected by Biomoby services. The table supports almost all possible data inputs a Biomoby service can ask for (except a collection of inputs - this will be added later; ask me if you need it sooner). The description how to enter data in the table is in a separate document (because the same table is used in a standalone client) docs/CreateInputClient.html (in your local jMoby directory), or from jMoby site . Here only shortly, what the table does:

It displays a full structure of a given data type and then it allows:

An alternative is to check the box Take an input from this XML file, and to give a file name with input data. This is how you can create such file in the first place:

  1. Select service, fill the Service Input Data.
  2. Check the box No real call, just show/echo input. Make sure that Show input as XML is checked.
  3. Click on Call service.
  4. Click on the Save icon in the bottom-left console.

Providing Unit Test Information

In the bottom right subpanel, Moby Unit Test Cases , there are 3 tabs. The tabs are Regex Tester tab, the XPath Tester tab, and the the Service Output XML Tester tab. These tabs allow you to enter test case information for a particular service that is applied to the output of the service given the sample input entered in Service Input Data widget.

The Regex Tester Tab

This tab consists of 2 components:

A text box for entering a regular expression to test against service output and a text area for viewing any matches when you hit the 'Test Regular Expression' button.

The XPATH Tester Tab

This tab consists of a single component. A text box for entering an XPATH expression to test against service output. Once you are satisfied that you have a suffienct test case, you can see if the expression entered actually matches any nodes in the output XML by hitting the 'Test XPATH Expression' button. If the expression entered matches the output XML, the button will turn green. If there are no matches, the button will turn red.

The Service Output Tester Tab

This tab allows you to enter the XML that you expect the service to output when called with our sample input. You can choose to enter this XML by hand or to copy over service results from the Service Results window using the convenient 'Copy' button. Once you are satisfied with the XML in the 'Expected service output XML' textarea you can compare it to the actual service output XML with the 'Test' button. This test will compare the actual contents of the XML messages, ignoring XML element/attribute ordering and whitespace. Any differences found will be shown to you in a pop up window.

Saving Unit Test Information

In order to save the unit testing information that you entered in this panel for the selected service, all that you have to do is click on the Save Your Unit Test button. This will prompt you for a place to save the test case information.

Download Unit Test

Some service providers will have already provided unit test information for their services. If you happen to select such a service, clicking on the Download Unit Test button will fill in the test case information for the selected service. You may then test the service (XPATH, regex) and compare its expected output to the actual service output.