Testing

Testing the KEE uses the test subcommand of the KEE commandline tool. The tests are run against test items (fixtures, see below). You can create fixtures manually (.json file) or retrieve actual test items from a Squirro project using the get_fixture subcommand. You can specify the handling of the fixtures in the testing section of the KEE config.json.

Fixtures

A fixture contains the item field and a keywords field (not to confuse with the keywords field of the item it self). The keywords field specifies the keywords and the respective values that are expected to be tagged by the KEE. Here is an example:

{
    "item": {
        "id": "fixture-3",
        "title": "News Ticker",
        "body": "Shares of AMZN stock tumbled today on some very curious news.",
    },
    "keywords": {
        "company": [
            "Amazon Inc."
        ]
    }
}

You can manually create a fixture or use the get_fixture subcommand:

squirro_kee -v get_fixture 'item-id1' 'item-id2'

The IDs of the items can be found in the URL when an item is selected in the EXPLORE tab of a project:

../../../_images/kee_retrieve_item_id.png

Provide the IDs of the items from which you want to create fixtures with the get_fixture command.

Note

You must provide a cluster, token and project_id in the "squirro" section of the config.json file (see here) for this to work.

Fixtures are stored in the folder fixtures/ in the KEE project or according to the configuration made in the testing section of the KEE config.json.

Testing

Once the fixtures are created, the KEE is tested using the test subcommand:

squirro_kee -v test

See the documentation or this tutorial for more details.