I’m a bit lost here.
I’m building an assistant that will rely heavily on functions inside my action server. So far, I have four custom actions. Ideally, I’d like to ensure that these custom actions always behave the way I intend for them to behave, especially as I start to develop the assistant further.
I wrote a list of things I’d like to assert and wrote a mock domain and tracker. So far, the tests only assert that the action names are correct, as shown below:
action_hello_world = ActionHelloWorld() assert(action_hello_world.name() == 'action_hello_world')
I don’t quite know how to execute the run function of each of these classes and assert that the returned events and response that will be sent to the user (through
dispatcher.utter_message) are correct.
I tried passing my mock tracker and domain into the function to assert that my events list will return empty , but the code raises a
TypeError when it reaches the line which calls the dispatcher as shown below:
action_hello_world = ActionHelloWorld() assert(action_hello_world.run(tracker=tracker, domain=domain, dispatcher=CollectingDispatcher)==)
File "/app/actions/actions.py", line 48, in run text=f"Hello world!") TypeError: utter_message() missing 1 required positional argument: 'self'
It’s obvious that I’m doing something wrong here. What is the best way to test custom actions on the action server without running into these kind of errors with the SDK?
Thanks in advance!