Using the SDK › Using Hooks
Using Hooks
This section explains how to extend DevTest Solutions with a new hook.
A hook is a mechanism that includes test setup logic or test teardown logic for all the tests running in DevTest. An alternative definition of a hook is a system-wide companion.
Hooks are used as follows:
- To configure test environments.
- To prevent the execution of tests that are not properly configured or do not follow defined best practices.
- To provide common operations.
Anything that a hook can perform can also be modeled as a companion. However, there are several differences between hooks and companions:
- Hooks are global in scope. Users do not specifically include a hook in their test case as is the required practice for companions. If you need every test to include the logic and want to prevent users from accidentally not including it, a hook is preferable.
- Companions can have custom parameters and are rendered in the model editor. Hooks are practically invisible to the user and therefore can request no special parameters. Hooks get their parameters from properties in the configuration or from the system.
- Hooks are deployed at the install level, not at the test case level. Assume a test is run on two computers. One computer has a hook that is registered, and the other does not. The hook runs only when the test is staged on the computer where it is explicitly deployed. The defined companions execute regardless of any install-level configuration.
This section contains the following topics:
Create a New Hook
Deploy a New Hook
Copyright © 2014 CA Technologies.
All rights reserved.
|
|