Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestProbe implementation #49

Open
benpillet opened this issue Nov 20, 2019 · 3 comments
Open

TestProbe implementation #49

benpillet opened this issue Nov 20, 2019 · 3 comments

Comments

@benpillet
Copy link

I’ve been looking at how Akka does testing and there’s a TestProbe class to support expected behavior. Is that something that would be useful for thespian? I’m gonna work on an experiment to see if I can write one. Are you interested in a PR for it?

@kquick
Copy link
Owner

kquick commented Nov 21, 2019

I hadn't been familiar with TestProbe, but it does look like it could be useful for testing based on a quick assessment. I think the main challenge will be determining the best way to provide this functionality in a Python/Thespian configuration, but I'd be happy to see something like this contributed to Thespian.

Do you have a draft of how you think this would look?

@benpillet
Copy link
Author

I don’t have a draft yet, but I’m gonna work on it the next week or so. I’m thinking a probe will have 2 main parts, a TestProbeActor and a corresponding TestProbe class outside the actor system. The TestProbe will use ask() to bring the messages out of the actor system to do assertions/expects. I don’t see a way to do the assertions directly on the TestProbeActor without complicating the interface too much. Let me know if I’m missing something around that. I’ll come back with a draft when I have something 👍

@kquick
Copy link
Owner

kquick commented Nov 28, 2019

Any assertion in an Actor will manifest as an exception: Thespian will re-instate the actor and try delivering the message again, and on the second failure it will re-instate the actor but return the message in a PoisonMessage wrapper to the sender. This may or may not be a useful method of testing for you, but your assertions/expects in the external TestProbe will likely integrate more directly with whatever testing framework you intend to use.

Thanks for the update, and I'm happy to provide more specific feedback when your plans are more concrete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants