Understanding Post-Hook and Pre Hook Mapping for Extensions on Download Actions

Overview

Tests that include the file like XMLtoTEXT extension may fail if the extension is incorrectly configured on a Download action. When the extension is set to run before the file is downloaded, it has no file to process. As a result, the converted text is never generated, causing subsequent steps to fail.


Symptoms

  • XMLtoTEXT output file is missing or empty.

  • Test steps that rely on converted text fail.

  • No explicit error is thrown by the XMLtoTEXT extension.

  • Download action completes successfully, but XMLtoTEXT processing does not occur.

What is the difference between Pre-hook and Post-hook?

  • Pre-hook: Runs before the primary action starts (before the file download begins).

  • Post-hook: Runs after the primary action completes (after the file is downloaded).

XMLtoTEXT requires an existing file and therefore must run as a Post-hook.

Can XMLtoTEXT be used as a Pre-hook?

No. XMLtoTEXT can only process files that already exist. When used as a Pre-hook on a Download action, the file does not yet exist, so the extension cannot function.


How to Fix the Issue

Follow these steps to correctly configure the XMLtoTEXT extension:

  1. Open the Download action in your test.

  2. Navigate to the Mappings tab.

  3. Locate the Map Extensions section.

  4. If xmltotext is listed under Pre-hook, remove it.

  5. Under Post-hook, click Add Extension.

  6. Select xmltotext from the list.

  7. Save your changes and re-run the test to verify the fix.


Limitations

  • The XMLtoTEXT extension can only process files that already exist.

  • If mapped as a Pre-hook on a Download step, the extension runs before the file is created.

  • The extension will not throw an explicit error—it simply produces no output, leading to failures in dependent test steps.


Best Practice

As a general guideline, any extension that needs to read, parse, or modify a downloaded file should always be configured as a Post-hook. This ensures the file is fully available before the extension attempts to access it.