Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The original version of this document is available on github with syntax highlighting 

Marvin - is a python testing framework for Apache CloudStack. Tests written using the framework use the unittest module under the hood. The unittest module is the Python version of the unit-testing framework originally developed by Kent Beck et al and will be familiar to the Java people in the form of JUnit. The following document will act as a tutorial introduction to those interested in testing CloudStack with python. This document does not cover the python language and we will be pointing the reader instead to explore some tutorials that are more thorough on the topic. In the following we will be assuming basic python scripting knowledge from the reader. The reader is encouraged to walk through the tutorial in full and explore the existing tests in the repository before beginning to write tests.

Installation

Marvin requires Python 2.6 for installation but the tests written using marvin utilize Python 2.7 to the fullest. You should follow the test environment setup instructions here before proceeding further.

...

  • setUp() - the setup method is run before every test method in the class and is used to initialize any common data, clients, resources required in our tests. In our case we have initialized our testclients - apiclient and dbclient identified the zone, domain and template we will need for the VM and created the user account into which the VM shall be deployed into.
  • Wiki Markup
    {{self.cleanup =\[\]}}. The cleanup list contains the list of objects which should be destroyed at the end of our test run in the tearDown method
  • tearDown() - the teardown method simply calls the cleanup (delete) associated with every resource thereby garbage collecting resources of the test

...

Code Block
bash
tsp@cloud:~/cloudstack# nosetests --with-marvin --marvin-config=demo.cfg --load test_deploy_vm.py
Test Deploy Virtual Machine  ok


----
Ran 1 test in 10.396s


OK

...