Can I get or modify the return value of the msg_sender() function from within a Unit Testing?

I tried to unit test admin.sw in sway-libs, but I found that calling msg_sender() function in unit test would cause the test to fail. Both solidity’s foundry test framework and cairo provide methods for modifying the test environment. Will sway provide such methods in the future?

Hi @wssh ,

Right now in-language unit testing is limited in it’s ability to setup more complex multi-party testing.

I’d recommend testing with the Typescript or Rust SDK for more advanced tests.

We have more sophisticated in-language unit testing configurations in the roadmap for Sway.

1 Like