Automation Using Marvin Framework by Sowmya Krishnan
- 3. 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
- 4. 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
- 7. 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
- 9. 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…
- 11. 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
- 12. 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
- 14. 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
Editor's Notes
- As contributions and features increase, it is critical to maintain the quality as well. Automation goes a long way in making this easier.
- Dependencies – setup.py “install-requires”
- 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