atat icon indicating copy to clipboard operation
atat copied to clipboard

Ease testing with ATAT

Open MathiasKoch opened this issue 4 years ago • 1 comments

Currently it is very hard to do unit tests that involve ATAT, due to the fn send<A: AtatCmd>(&mut self, cmd: &A) -> nb::Result<A::Response, Error>; signature.

It would be nice to create and document some method of making it easy to do unittest involving sending multiple different commands after eachother, and asserting on the response.

Main problem is that even if instantiating a MockAtClient of some kind, that implements AtClient, it is very hard to construct a A::Response in a way fit for testing multiple send/receive cycles.

NOTE: This problem is not an actual problem for ATAT, but rather for the users of ATAT. Yet i think the solution should ideally come within ATAT

MathiasKoch avatar Feb 03 '21 07:02 MathiasKoch

Add an example using https://docs.rs/mockall/0.10.2/mockall/#sequences

MathiasKoch avatar Sep 06 '21 09:09 MathiasKoch