riker-rs / riker

Easily build efficient, highly concurrent and resilient applications. An Actor Framework for Rust.
https://riker.rs
MIT License
1.01k stars 71 forks source link

Single threaded ActorRefs for unit testing #177

Open christopinka opened 1 year ago

christopinka commented 1 year ago

Is there a way to get ActorRefs for unit testing without the system context? actor_cell.rs isn't a public mod?

Does it make sense to be able to use ExtendedCell::new() in unit tests?

hardliner66 commented 1 year ago

IIRC, there isn't and shouldn't be a way. You need a system to run the actors anyway.

Also, note that there has been no development on riker since 2021.

christopinka commented 1 year ago

Understood. How do you recommend unit testing behavior in receive function? Thanks

christopinka commented 1 year ago

Do you know of any plans to handoff the project to other owners?

hardliner66 commented 1 year ago

There were plans to create an organization or something similar, but it never became reality. The original author disappeared multiple times already, without a leaving a clue on what is going on.

You are probably better of using a different framework like stakker or coerce.

As to your original question: You can just set up a system and spawn the actor you want to test and send appropriate messages to it. If the actor needs other actors, you can pass the actor refs to an actor who handles the same messages as the real one, but provides mock behavior for that test.