SlideShare a Scribd company logo
Automation with Marvin
Sowmya Krishnan
18 Dec 2013
Agenda
What is Marvin?
Components
Libraries
Demo
Anatomy of a Test
Best Practices
Automation with Marvin
Marvin
• Test framework for CloudStack written in
Python
• Written using python’s unittest
• Integration Tests
• API
• Virtual Machines
• Storage Pool
• Network
• Database
• Smoke and Component Tests
Automation with Marvin
Setting up Marvin
Build
mvn -P developer -pl :cloud-marvin
Install
pip install tools/marvin/dist/Marvin-0.1.0.tar.gz
8096 is open
Automation with Marvin
Dependencies
Python 2.7 (unittest)
python-paramiko (ssh)
mysql-connector-python (DB)
Nose (test framework to run tests)
should-dsl (asserts)
ddt (few tests)
python setup.py install
Automation with Marvin
Components
Deploy
deployDataCenter.py
Test Scripts
test*.py
Test Runner
nose
Logging
python logger (logging)
Automation with Marvin
Libraries
• base.py
• Implementations of all possible operations that
can be performed on resources
• utils.py
• Common utility functions
o Generate random string, format volume, get a process
status …
• common.py
• Cloudstack specific common utility functions like
add netscaler device, return current zone, pod…
Automation with Marvin
Demo
Automation with Marvin
Anatomy of a test
Automation with Marvin
Imports:
cloudstackTestCase class provides API and DB client
for making API calls and for validating DB values
using SQL queries. All tests implement this class
Integration.lib.base, common and utils (Common
Libraries )
Test configs
Defines test configs/data in the form of key value
pairs. Mostly configuration values like template
name, instance name, network offering values…
Anatomy of a test
Automation with Marvin
Anatomy of a test
Test Class
Consists of all test suites that needs to be carried out
setUp()
Runs before each test
tearDown()
Runs after each test, typical cleanups
test_vm_deploy
Test scenario: APIs to execute the test, validation against
expected results using assert()
setUpClass()
Runs before each test class
tearDownClass()
Runs after each test class
Automation with Marvin
Best Practices
Tests run with individual accounts created during setup and
deleted after test is run
Ensure cleanup happens always – even if there’s an exception
API Exceptions vs Python Exceptions
Services class for configs :Replace with config file
Ensure few smoke tests are in place before merging new feature
Post every check-in, run smoke tests with simulator (doesn’t
require a full-fledged cloud set up running)
Automation with Marvin
Documentation and References
https://cwiki.apache.org/confluence/display/CLOUDSTACK/Marvin+-
+Testing+with+Python
https://cwiki.apache.org/confluence/display/CLOUDSTACK/Marvin+Ref
actor
http://jenkins.buildacloud.org/view/cloudstack-qa/job/test-smoke-matrix/
Insert Presentation Title Here
Get Involved
Web: http://cloudstack.apache.org/
Mailing Lists: cloudstack.apache.org/mailing-lists.html
IRC: irc.freenode.net: 6667 #cloudstack
Twitter: @cloudstack
LinkedIn: www.linkedin.com/groups/CloudStack-Users-Group-3144859
If it didn’t happen on the mailing list, it didn’t happen.
Insert Presentation Title Here
Thank You!
Automation with Marvin

More Related Content

Automation Using Marvin Framework by Sowmya Krishnan

Editor's Notes

  1. As contributions and features increase, it is critical to maintain the quality as well. Automation goes a long way in making this easier.
  2. Dependencies – setup.py “install-requires”
  3. Deploy – pre configured environment or use deployAndRun.py Test scripts – Data, Scenario, expected resultsTest Running – noseLogging – Test Client Log – by default, we log INFO level, can add debug logs wherever necessary