tencent cloud

Serverless Cloud Function

Release Notes and Announcements
Release Notes
Announcements
User Guide
Product Introduction
Overview
Related Concepts
How It Works
Strengths
Scenarios
Related Products
Purchase Guide
Billing Overview
Billing Mode
Billable Items and Billing Modes
Function Computing Power Support
Free Tier
SCF Pricing
Billing Example
Payment Overdue
Getting Started
Creating Event Function in Console
User Guide
Quota Management
Managing Functions
Web Function Management
Log Management
Concurrence Management
Trigger Management
Function URL
A Custom Domain Name
Version Management
Alias Management
Permission Management
Running Instance Management
Plugin Management
Managing Monitors and Alarms
Network Configuration
Layer Management
Execution Configuration
Extended Storage Management
DNS Caching Configuration
Resource Managed Mode Management
Near-Offline Resource Hosting Model
Workflow
Triggers
Trigger Overview
Trigger Event Message Structure Summary
API Gateway Trigger
COS Trigger
CLS Trigger
Timer Trigger
CKafka Trigger
Apache Kafka Trigger
MQTT Trigger
Trigger Configuration Description
MPS Trigger
CLB Trigger Description
TencentCloud API Trigger
Development Guide
Basic Concepts
Testing a Function
Environment Variables
Dependency Installation
Using Container Image
Error Types and Retry Policies
Dead Letter Queue
Connecting SCF to Database
Automated Deployment
Cloud Function Status Code
Common Errors and Solutions
Developer Tools
Serverless Web IDE
Calling SDK Across Functions
Third-Party Tools
Code Development
Python
Node.js
Golang
PHP
Java
Custom Runtime
Deploying Image as Function
Web Framework Development
Deploying Framework on Command Line
Quickly Deploying Egg Framework
Quickly Deploying Express Framework
Quickly Deploying Flask Framework
Quickly Deploying Koa Framework
Quickly Deploying Laravel Framework
Quickly Deploying Nest.js Framework
Quickly Deploying Next.js Framework
Quickly Deploying Nuxt.js Framework
Quickly Deploying Django Framework
Use Cases
Overview
Solutions with Tencent Cloud Services
Business Development
TRTC Practices
COS Practices
CKafka Practice
CLS
CLB Practice
MPS
CDN
CDWPG
VOD
SMS
ES
Scheduled Task
Video Processing
Success Stories
Tencent Online Education
Online Video Industry
Tencent Online Education
Best Practice of Tencent IEG Going Global
API Documentation
History
Introduction
API Category
Making API Requests
Other APIs
Namespace APIs
Layer Management APIs
Async Event Management APIs
Trigger APIs
Function APIs
Function and Layer Status Description
Data Types
Error Codes
SDK Documentation
FAQs
General
Web Function
Billing FAQs
Network FAQs
Log FAQs
SCF utility class
Event Handling FAQs
API Gateway Trigger FAQs
Related Agreement
Service Level Agreement
Contact Us
Glossary

Testing a Function

PDF
Focus Mode
Font Size
Last updated: 2025-10-20 15:57:46
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 Function Service 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 area of Test event.

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.

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback