Automation Using Marvin Framework by Sowmya Krishnan
-
Upload
radhika-nair -
Category
Technology
-
view
370 -
download
0
Transcript of Automation Using Marvin Framework by Sowmya Krishnan
Automation with MarvinSowmya Krishnan18 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 TestsAutomation with Marvin
Setting up Marvin
Buildmvn -P developer -pl :cloud-marvin
Installpip 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
DeploydeployDataCenter.py
Test Scriptstest*.py
Test Runnernose
Loggingpython 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 ClassConsists 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+Refactor
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