Skip to content
michsmit99 edited this page Oct 25, 2014 · 9 revisions

Toolkit Unit Tests

The acitoolkit package has a unit test suite that strives for a minimum of 100% code coverage. The test suite is contained within the acitoolkit_test.py file. Within the test suite, many of the tests are considered live tests. Live tests are those that actually communicate with an APIC and push configuration to/from the APIC. These tests can be skipped by setting the LIVE_TEST variable at the top of the file to False. The test suite covers the acitoolkit.py and acibaseobject.py files.

When adding additional code or making changes to the toolkit, please ensure that unit tests are added to cover the new functionality and that the entire test suite is run against the modified toolkit before submitting the code. Minimal code coverage can be verified using tools such as coverage.py. For instance, after installing coverage.py, the toolkit can be run with the command coverage run acitoolkit_test.py and an HTML report of the code coverage can be generated with the command coverage html. If changes are made to the acitoolkit.py file, please ensure that the acitoolkit_test.py is run and that code coverage remains at 100%.

Toolkit CLI Application Unit Tests

The CLI application does not have formal unit tests in the same manner as the actual toolkit. It is tested separately using the command line option -t followed by a filename that contains a list of commands to be executed by the CLI. This allows code coverage tools to also run on the CLI application. A sample file named test_cli.txt is included in the toolkit that was used during development to get as much CLI test coverage as possible.