I've only spent a little bit of time on godot-rust myself, but from what I hear you have to use some sort of third-party library to help out. I've heard gd-rehearse might be what you're looking for, but never got it working myself (though I didn't try very hard).
I've resorted to mostly using gdscript, and in rust just making my structures normal rust structs which I can unit test, just adding thin wrappers which use Gd<T>
which call into my standard tested rust code. As long as what you're testing doesn't touch Gd<T>
it seems to be testable in the normal way without crashing, using #[test]
... but I admit it's not ideal
Edit: there's a godot-rust discord linked from their main docs page which is much more active than this place could be, you might get a better answer there