How to use register_message method in locust

Best Python code snippet using locust

messages.py

Source:messages.py Github

copy

Full Screen

2from __future__ import absolute_import, unicode_literals3from wechatpy.fields import IntegerField, StringField4from wechatpy import messages5MESSAGE_TYPES = {}6def register_message(msg_type):7 def register(cls):8 MESSAGE_TYPES[msg_type] = cls9 return cls10 return register11@register_message('text')12class TextMessage(messages.TextMessage):13 agent = IntegerField('AgentID', 0)14@register_message('image')15class ImageMessage(messages.ImageMessage):16 agent = IntegerField('AgentID', 0)17@register_message('voice')18class VoiceMessage(messages.VoiceMessage):19 agent = IntegerField('AgentID', 0)20@register_message('shortvideo')21class ShortVideoMessage(messages.ShortVideoMessage):22 agent = IntegerField('AgentID', 0)23@register_message('video')24class VideoMessage(messages.VideoMessage):25 agent = IntegerField('AgentID', 0)26@register_message('location')27class LocationMessage(messages.LocationMessage):28 agent = IntegerField('AgentID', 0)29@register_message('link')30class LinkMessage(messages.LinkMessage):31 agent = IntegerField('AgentID', 0)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run locust automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful