There are currently three ways to test your component in CloudStack.
Unit Tests can be written using Mockito and Spring for your plugin/component and will run as part of the build system. Tests that attempt to access a database or network resource belong to an integrated test. Documentation on writing UnitTests is here
These are tests that will run on a working setup of CloudStack. In other words, the entire management server, hypervisor setup etc is assumed to exist and/or presetup before running these tests. One can think of these as system tests. They are written in python using marvin.
1. How to write integrated tests for CloudStack
2. How to include your integrated tests in the build phase
These are like the integration tests, but they use the simulator hypervisor, which just pretends to do the work its given. They require a working database and running management server. These tests should be run before pushing changes upstream or submitting to reviewboard.
See how to run the smoke tests using the simulator.