Permalink
..
Failed to load latest commit information.
data Removed unnecessary files Sep 23, 2015
modularinput Updated copyright date from 2011-2014 to 2011-2015 Sep 20, 2015
searchcommands Fix 'maxresultrows' extraction bug Jul 6, 2016
README.md Edited the test suite readme Dec 6, 2012
__init__.py Fixed running test suite and coverage from the command line. Oct 23, 2012
test_all.py Fixed tests for Python 2.6 Sep 23, 2015
test_app.py Updated copyright date from 2011-2014 to 2011-2015 Sep 20, 2015
test_binding.py Add Basic Auth support Jan 29, 2016
test_collection.py Updated copyright date from 2011-2014 to 2011-2015 Sep 20, 2015
test_conf.py Updated copyright date from 2011-2014 to 2011-2015 Sep 20, 2015
test_data.py Updated copyright date from 2011-2014 to 2011-2015 Sep 20, 2015
test_event_type.py Updated copyright date from 2011-2014 to 2011-2015 Sep 20, 2015
test_examples.py Add KV Store support to the Python SDK Nov 21, 2015
test_fired_alert.py Updated copyright date from 2011-2014 to 2011-2015 Sep 20, 2015
test_index.py Fix Index.submit() paths for namespaced services Nov 22, 2016
test_input.py Add test coverage for unknown input types Dec 19, 2016
test_job.py Fixed tests for Python 2.6 Sep 23, 2015
test_kvstore_batch.py Add KV Store support to the Python SDK Nov 21, 2015
test_kvstore_conf.py Add KV Store support to the Python SDK Nov 21, 2015
test_kvstore_data.py Add KV Store support to the Python SDK Nov 21, 2015
test_logger.py Updated copyright date from 2011-2014 to 2011-2015 Sep 20, 2015
test_message.py Updated copyright date from 2011-2014 to 2011-2015 Sep 20, 2015
test_modular_input.py Updated copyright date from 2011-2014 to 2011-2015 Sep 20, 2015
test_modular_input_kinds.py Updated copyright date from 2011-2014 to 2011-2015 Sep 20, 2015
test_results.py Updated copyright date from 2011-2014 to 2011-2015 Sep 20, 2015
test_role.py Updated copyright date from 2011-2014 to 2011-2015 Sep 20, 2015
test_saved_search.py Updated copyright date from 2011-2014 to 2011-2015 Sep 20, 2015
test_service.py Fixed final test failures :) Sep 23, 2015
test_storage_passwords.py Updated copyright date from 2011-2014 to 2011-2015 Sep 20, 2015
test_user.py Updated copyright date from 2011-2014 to 2011-2015 Sep 20, 2015
test_utils.py remove unused imports from test_utils.py Nov 14, 2014
testlib.py Add Travis CI support for the Python SDK Nov 20, 2015

README.md

Splunk Test Suite

The test suite uses Python's standard library and the built-in unittest library. If you're using Python 2.7, you're all set. However, if you are using Python 2.6, you'll also need to install the unittest2 library to get the additional features that were added to Python 2.7 (just run pip install unittest2 or easy_install unittest2).

To run the unit tests, open a command prompt in the /splunk-sdk-python directory and enter:

python setup.py test

You can also run individual test files, which are located in /splunk-sdk-python/tests. Each distinct area of the SDK is tested in a single file. For example, roles are tested in test_role.py. To run this test, open a command prompt in the /splunk-sdk-python/tests subdirectory and enter:

python test_role.py

NOTE: Before running the test suite, make sure the instance of Splunk you are testing against doesn't have new events being dumped continuously into it. Several of the tests rely on a stable event count. It's best to test against a clean install of Splunk, but if you can't, you should at least disable the *NIX and Windows apps. Do not run the test suite against a production instance of Splunk! It will run just fine with the free Splunk license.

Code Coverage

Coverage.py is an excellent tool for measuring code coverage of Python programs.

To install it, use easy_install:

easy_install coverage

Or use pip:

pip install coverage

To generate a report of the code coverage of the unit test suite, open a command prompt in the /splunk-sdk-python directory and enter:

python setup.py coverage

This command runs the entire test suite and writes an HTML coverage report to the /splunk-sdk-python/coverage_report directory.

For more information about Coverage.py, see the author's website (http://nedbatchelder.com/code/coverage/).