OpenSocial Compliance Tests

WORK IN PROGRESS

OpenSocial 0.8 and previous

For OpenSocial versions 0.8 and previous, the compliance test suites are hosted within the OpenSocial Resources google code project.  They can be checked out and executed from http://opensocial-resources.googlecode.com/svn/tests/trunk/.

OpenSocial Compliance Tests in Apache Shindig

The current repository for OpenSocial compliance tests is now the Apache Shindig project.  While there should be no dependency between the compliance test cases and Shindig, the tests co-exist there in order to take advantage of Shindig's vibrant developer community.  The JavaScript compliance tests now use JQuery's QUnit framework.  REST based compliance tests are scripted to allow the use of command line tools to execute HTTP requests using tools like oacurl or rest-client.

OS 1.1 JavaScript Test Suites

The JavaScript compliance tests are now located under https://svn.apache.org/repos/asf/shindig/trunk/content/gadgets/compliance/javascript-tests and can easily be extended by adding test cases to the appropriate suites.  Currently, many tests have been ported to OpenSocial 1.1, but as OpenSocial 2.0 starts to move ahead we will need help writing tests for new specification version.

Executing the JavaScript tests

The JavaScript tests exercise the OpenSocial JavaScript APIs.  To execute a particular test suite, run Shindig to host the Gadget XML and JavaScript files you'll need, then add the appropriate Gadget listed in the table above to the Gadget Container you want to test. 

Tests are executed within your container automatically once it has been added.  This is accomplished by registering a handler using gadgets.util.registerOnLoadHandler so the tests will not run if your container has not properly implemented that Core Gadget API.  The tests are executed using QUnit and results are reported within Gadget's frame on the page.  The tests also make use of the dynamic-height feature to fix the size of the gadget to accommodate test results.

Extending the JavaScript tests

Adding new JavaScript tests is as simple as adding new QUnit tests to the enclosing function in the test suite's JavaScript file as listed above.  For more info on how to write QUnit tests, please refer to the QUnit documentation.

If you decide to create a new test suite, make sure to create a new Gadget for it by copying one of the existing ones and updating the appropriate references.  You will also likely want to link it back to the All Tests suite Gadget which is as simple as including your JavaScript file and adding a call to your enclosing test suite function in OnLoad handler in the All Tests Gadget.

REST Test Suites

To be written..