Automation Using Marvin Framework by Sowmya Krishnan

15
Automation with Marvin Sowmya Krishnan 18 Dec 2013

Transcript of Automation Using Marvin Framework by Sowmya Krishnan

Page 1: Automation Using Marvin Framework by Sowmya Krishnan

Automation with MarvinSowmya Krishnan18 Dec 2013

Page 2: Automation Using Marvin Framework by Sowmya Krishnan

Agenda

What is Marvin?

Components

Libraries

Demo

Anatomy of a Test

Best Practices

Automation with Marvin

Page 3: Automation Using Marvin Framework by Sowmya Krishnan

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

Page 4: Automation Using Marvin Framework by Sowmya Krishnan

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

Page 5: Automation Using Marvin Framework by Sowmya Krishnan

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

Page 6: Automation Using Marvin Framework by Sowmya Krishnan

Components

DeploydeployDataCenter.py

Test Scriptstest*.py

Test Runnernose

Loggingpython logger (logging)

Automation with Marvin

Page 7: Automation Using Marvin Framework by Sowmya Krishnan

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

Page 8: Automation Using Marvin Framework by Sowmya Krishnan

Demo

Automation with Marvin

Page 9: Automation Using Marvin Framework by Sowmya Krishnan

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…

Page 10: Automation Using Marvin Framework by Sowmya Krishnan

Anatomy of a test

Automation with Marvin

Page 11: Automation Using Marvin Framework by Sowmya Krishnan

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

Page 12: Automation Using Marvin Framework by Sowmya Krishnan

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

Page 13: Automation Using Marvin Framework by Sowmya Krishnan

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

Page 14: Automation Using Marvin Framework by Sowmya Krishnan

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

Page 15: Automation Using Marvin Framework by Sowmya Krishnan

Thank You!

Automation with Marvin