tencent cloud

Feedback

Testing a Function

Last updated: 2023-04-27 17:52:49
    SCF provides a function test feature in the console. With it, you can invoke a function to trigger events, and then check the result, response, and logs.

    Directions

    1. Log in to the SCF console and select Functions on the left sidebar.
    2. On the Functions page, click the target function to enter its details page.
    3. Select Function codes on the Function management page.
    4. Select the target test template in the Editor.
    
    5. Click Test to test the function.

    Preset Testing Event Templates

    A testing event template is used to simulate the event and content passed to a function when the corresponding trigger triggers the function, which is represented as the event input parameter in the function. The template must be in JSON format. SCF provides the following templates for now.
    Hello World: This is a simple custom event template that allows you to enter custom event content when you trigger a function through TencentCloud API.
    Files uploaded to/deleted from a COS bucket: This simulates an event that is generated and passed upon function triggering when a file is uploaded or deleted in a bucket.
    CMQ topic: This simulates an event that is generated and passed upon function triggering when a message is received in CMQ.
    API Gateway: This simulates an event that is generated and passed upon function triggering when an API request arrives API Gateway.

    Custom Testing Event Template

    You can modify the preset templates based on your own requirements, and save them as your custom templates.

    Use limits

    
    Custom testing event templates are configured at the account level, which means the templates are shared by functions under the same account.
    Up to 5 custom testing templates can be configured for a single account.
    A custom testing template can be up to 64 KB in size.

    Creating custom testing event templates

    Select a preset template and click Create Template. Make changes as you want, specify a new template name and save it as a custom template. This template is used by default next time when you enter the test page.

    Deleting custom testing event templates

    To delete a custom template that is no longer used, select the template and click Delete.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support