How to dynamically change iparams automatically for serverless tests?

Hi Riviraj,

I have a quick question. I believe the iParams get added to the payload automatically as per the manual testing of severless apps. Is there anyway to automate changing these so that tests run against different iParams settings?

Thanks,

Rob

1 Like

Hi @RobAtOpinyin,

If you’re looking to mock the iparams in the Serverless events arguments when running Serverless tests, it can be done by sending a mock JSON object as an argument when invoking the event. This custom JSON object can be modified in runtime to satisfy your needs to modify the iparams in the argument as shown in the following code.

this.invoke('onExternalEvent', {
  "account_id": 12345,
  "event": "onExternalEvent",
  "timestamp": 1230000000,
  "domain": "https://sample.freshdesk.com",
  "options": "freshdesk.onExternalEvent",
  "data": "{}",
  "iparams": {
    "iparam1": "abc",
    "iparam2": "123"
  }
});
1 Like

Thanks Raviraj. That’s great.

1 Like