Scripting
Overview

Scripting

In Thunder Client you can write custom scripting for advanced use cases like setting environment variables, extracting data from responses, test assertions and more.

Inline Scripting

  • JavaScript code can be written directly within Thunder Client views.
  • You have the flexibility to write scripts in the following contexts:
    • Request Level
    • Folder Level
    • Collection Level
  • Additionally, scripts can be authored in Pre-Request and Post-Request scripts.

Pre Request Script

  • Run Pre Request script from Pre Run -> Scripting tab, useful to set Env Variables

img


Post Request Script

  • Run the Post Request script from Tests -> Scripting tab.
  • Useful to do clean-up tasks, set environment variables from the response and assertions.

img

Logs

  • You can log messages to the Output Window using console.log in the script.
  • For more details, please refer to the Logs section.

Convert Postman Script

  • We provide a guide to convert Postman scripts to Thunder Client scripts.
  • For more details, please refer to the Convert Postman Script section.