# Configuring Hooks

Hooks can be configured via the Hooks tab and can be configured in the same way as you configure any test case in vREST NG.

Few important points to note in configuring hooks:

  1. Type of hook
    • vREST provides 8 types of hooks and data sent to each type of hook is different.
    • The purpose of each type of hook and the information which is available to them is written in the guide Hook Types.
  2. Hook Condition
    • A hook condition can be specified in the "Details" sub-tab of the individual hook.
    • Few Use Cases:
      • Suppose you want to execute post-test case iteration hook for failed test cases, then provide !{{$tc.result.isPassed}} as a condition of the hook.
      • Suppose you want to execute post-test run hook if there are some failed test cases, then provide {{$tr.result.failedCount}} > 0 as a condition of the hook.
      • Suppose for a data-driven test case, you may want to execute any test case related hook(s) only for the first iteration of the test case then you may provide {{$tc.details.loopIndex}} === 0 as a condition of the hook.
      • Suppose if you want to execute some test suite or test case related hooks only for some specific test suite(s), then you may provide "{{$ts.details.name}}" === "Test Suite 1" or "{{$ts.details.name}}" === "Test Suite 1" || "{{$ts.details.name}}" === "Test Suite 2" as a condition of the hook.
    • For more information on which data is available for each type of hook, please visit our guide on Hook Types.
  3. Viewing hook results
    • Hook results can be seen in the Test Cases tab.
    • Test Run and test suite specific hooks results
      • These are shown when you click on the Hook Results link available in the Running Status section as shown in the following snapshot.
      • When you click on the Hook Results link, a dialog window will appear showing the individual hook results.
    • Test Case specific hook results
      • These are shown in the "Hooks" sub-tab of the individual test case as shown in the following snapshot.