Scripting
Overview

Scripting

There are two ways you can write custom scripting in Thunder Client for advanced use cases.

  1. Inline Scripting: You can write javascript code inside the Thunder Client views.
  2. Custom Filters: You can write code in separate javascript files and attach it to a collection.

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.