Scripting
Postman to TC

Convert Postman Script

  • Below is a comprehensive guide for converting Postman scripts to Thunder Client scripts.
  • You can find the complete Thunder Client Scripting API here.

Global Variables

The following global variables available in the scripting.

Postman VariableThunder Client Variable
pmtc
pm.expectexpect
pm.assertassert
btoabtoa
atobatob

Built in Libraries

The following built-in libraries are available in the scripting

Postman LibraryThunder Client Library
ajvajv
---ajv-formats
---axios
atobatob
btoabtoa
bufferbuffer
chaichai
cheeriotc.loadModule('cheerio')
crypto-jscrypto-js
csv-parse/lib/sync (opens in a new tab)papaparse or use tc.loadModule('csv-parse')
---fs
---http
---https
lodashtc.loadModule('lodash')
momenttc.loadModule('moment')
streamstream
---tough-cookie
tv4tc.loadModule('tv4')
urlurl
utilutil
uuiduuid
xml2jsfast-xml-parser

Request

Request object available properties and methods.

Postman PropertyThunder Client Property
---tc.request.id
---tc.request.name
pm.request.urltc.request.url
pm.request.methodtc.request.method
pm.request.headerstc.request.headers
pm.request.bodytc.request.body
---tc.request.getHeader()
pm.request.headers.add()tc.request.setHeader()
pm.request.headers.remove()---
---tc.request.setBody()

Response

Response object available properties and methods.

Postman PropertyThunder Client Property
pm.response.codetc.response.status
pm.response.status---
pm.response.responseTimetc.response.time
pm.response.responseSizetc.response.size
---tc.response.contentType
pm.response.json()tc.response.json
pm.response.text()tc.response.text
pm.response.headerstc.response.headers
---tc.response.cookies
---tc.response.getHeader()

Info

Get the additional information of the current executing request

Postman PropertyThunder Client Property
pm.info.eventName---
pm.info.iterationtc.info.currentIteration
pm.info.iterationCounttc.info.totalIterations
pm.info.requestIdtc.request.id
pm.info.requestNametc.info.requestName
pm.environment.nametc.info.environmentName
---tc.info.collectionName
---tc.info.folderName

Environments

Please see the available Environment methods between Postman and Thunder Client.

Postman MethodsThunder Client Methods
pm.variables.get()tc.getVar()
pm.variables.set()tc.setVar()
pm.collectionVariables.get()tc.getVar()
pm.collectionVariables.set()tc.setVar()
pm.environment.get()tc.getVar()
pm.environment.set()tc.setVar()
pm.globals.get()tc.getVar()
pm.globals.set()tc.setVar()
pm.iterationData.get()tc.getVar()

Methods

Please see the available methods between Postman and Thunder Client.

Postman MethodsThunder Client Methods
pm.cookies.has()---
pm.cookies.get()tc.getCookies()
pm.cookies.jar().set()tc.setCookie()
pm.cookies.jar().getAll()tc.getCookies()
pm.cookies.jar().unset()tc.clearCookies()
pm.cookies.jar().clear()tc.clearCookies()
pm.sendRequest()axios or tc.runRequest()
pm.execution.skipRequest()tc.skipRequest()
postman.setNextRequest()try using tc.skipRequest()
pm.visualizer.set()tc.chartView()
pm.test()tc.test()
pm.expect()expect()

Feedback