After you define a function, you must test the function to ensure that your code is correct. When API Gateway triggers a function, information from API Gateway is sent to the function as input parameters in the form of an event. You can use the event information from API Gateway to test whether your function code is correct. This topic describes how to test a function in the Function Compute console.

Prerequisites

Define a function

Procedure

  1. Log on to the Function Compute console.
  2. In the top navigation bar, select your region.
  3. In the left-side navigation pane, click Service/Function.
  4. Find the target function in the target service and click the name of the function.
  5. On the Code tab, click Event.
  6. Write an event in the code editor based on the corresponding event format. For more information, see . Then click OK.
  7. On the Code tab, click Invoke.

Result

On the Code tab, a prompt appears that shows successful function invocation.result