Quick Test Execute Code Script Command

Prev Next

Deprecation Notice

This feature has been deprecated as of the September 2025 release. It will remain fully supported for existing customers but will no longer receive enhancements or updates. We recommend transitioning to our Test Automation solution, which offers advanced capabilities for faster, smarter, and more scalable testing.

Use Quick Run to execute JavaScript code services, allowing the player to communicate with other systems via APIs.

For example - you can trigger a request to pull current currency exchange rates, as shown below.

You can use the following functions - 

  • httpGet
    Use the httpGet function to generate an HTTP GET request.
    var Results = httpGet(URL)
     

  • httpPost
    Use the httpPost function to generate an HTTP POST request.
    var Results = httpPost(URL, POST_DATA)
     

  • panayaVars
    You can read or update any Panaya parameter values within the code using the syntax panayaVars.parameterName.
    To do this, use the parameters defined in previous steps; see the example below.

    Important!

    When utilizing panayaVars in Javascript, use the exact capitalization case for the parameter names.


Example - Pull Exchange Rate Value

var currencyJsonResult = httpGet('https://api.frankfurter.app/latest?from=USD&to=GBP'); //Receive the currency exchange rate value

      //Example of result:  {"amount":1.0,"base":"USD","date":"2024-06-25","rates":{"GBP":0.78836}}
 

var jsobObj = JSON.parse(currencyJsonResult);

var rateGbpToUsd = jsobObj.rates.GBP; //Extract the GBP to USD exchange rate value from results using JS parser

if (rateGbpToUsd > 0) //If the rate is larger than 0, then 

{

    panayaVars.productPrice = rateGbpToUsd*panayaVars.productPrice; //Populate the <productPrice> parameter. 
//productPrice is a predefined Panaya parameter

}