Test Management
Precautions
Event data is passed to the handler of your function as an input. After configuration, event data is persisted for later use. Each function can have a maximum of 10 test events.
Creating a Test Event
- Log in to the FunctionGraph console, and choose Functions > Function List in the navigation pane.
- Click a function name.
- On the displayed function details page, select a version and choose Select test event > Configure test event, as shown in Figure 1.
- In the Configure Test Event dialog box, configure the test event information according to Table 1. The parameter marked with an asterisk (*) is mandatory.
Table 1 Test event information Parameter
Description
Configure Test Event
You can choose to create a test event or edit an existing one.
Use the default option Create new test event.
Event Template
If you select blank-template, you can create a test event from scratch.
If you select a template, the corresponding test event in the template is automatically loaded. For details about event templates, see Table 2.
The obs-event-template template can be used to simulate OBS events to trigger functions.
*Event Name
The event name can contain 1 to 25 characters and must start with a letter and end with a letter or digit. Only letters, digits, underscores (_), and hyphens (-) are allowed. For example, even-123test.
Event data
Enter a test event.
Table 2 Event template description Template Name
Description
blank-template
The template event is {"key": "value"}, which can be changed based on requirements.
apig-event-template
Simulates an API Gateway event to trigger your function.
dms-event-template
Simulates a DMS event to trigger your function.
dis-event-template
Simulates a DIS event to trigger your function.
smn-event-template
Simulates an SMN event to trigger your function.
obs-event-template
Simulates an OBS event to trigger your function.
timer-event-template
Simulates a timer event to trigger your function.
lts-event-template
Simulates an LTS event to trigger your function.
cts-event-template
Simulates a CTS event to trigger your function.
dds-event-template
Simulates a DDS event to trigger your function.
kafka-event-template
Simulates a Kafka event to trigger your function.
login-security-template
Serves as an input for the loginSecurity-realtime-analysis-python function template.
porn-image-analyse
Serves as an input for the porn-image-analysis function template.
voice-analyse
Serves as an input for the voice-analysis function template.
image-tag
Serves as an input for the image-tag and porn-image-analysis function templates.
- Click Save.
Testing a Function
After creating a function, you can test it online to check whether it can run properly as expected.
- Log in to the FunctionGraph console, and choose Functions > Function List in the navigation pane.
- Click a function name.
- On the displayed function details page, select a version and test event, and click Test.
Figure 2 Testing a function
- Click Test. The function test result is displayed, as shown in Figure 3.
Modifying a Test Event
- Log in to the FunctionGraph console, and choose Functions > Function List in the navigation pane.
- Click a function name.
- On the displayed function details page, select a version and choose Select test event > Configure test event.
- In the Configure Test Event dialog box, modify the test event information according to Table 3.
- Click Save.
Deleting a Test Event
- Log in to the FunctionGraph console, and choose Functions > Function List in the navigation pane.
- Click a function name.
- On the displayed function details page, select a version and choose Select test event > Configure test event.
- In the Configure Test Event dialog box, select the test event you want to delete according to Table 4.
- Click Delete.
Last Article: Trigger Management
Next Article: Version and Alias Management



Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.