mozilla-b2g/fxos-certsuite — pull request #4 by malini (2014-03-10 22:01:06+00:00)
Title: example tests

To run the tests you can do:

`source run.sh`

which will set up a virtualenv for you and execute the tests in the webapi_tests/manifest.ini. After running run.sh, you'll have a "webapi_venv" virtual environment you can use.

Alternatively, you can set up your own virtual environment and run 'python setup.py develop' in the webapi_tests folder, so all tests will have access to the MinimalTestCase object through the webapi_tests module.
=====

There are two example tests, test_orientation.py which is very simple since we have an API call to get data, and test_proximity.py which sets up an event listener since some webapis don't have an API for information retrieval.

So the test case example is the test_proximity.py file. The test case will run but unfortunately won't pass since the event listener for 'userproximity'/'deviceproximity' doesn't seem to be picking up the events, either due to my build or some other reason (I've run this code outside of this test, directly against the device in a system app and I still don't get the events...), but if you change that event to something that does fire, like 'touchstart' or whatever, you'll see that the the test will pass.

In any case, the test flow will work as expected and you can use this to write tests.