rust-ffi-guide
rust-ffi-guide copied to clipboard
Testing Chapter
I've started off a chapter on testing the application, both by integrating Rust unit tests into cmake
as well as writing end-to-end integration tests that use the C++ wrappers.
So far the general idea is:
As well as the usual unit tests which you will be accustomed to writing in your Rust code, we want to be able to test the entire backend from end-to-end. This would require using the C++ wrappers to send off requests under various conditions and making sure we get the expected behaviour.
We will cover:
- Integrating cargo test into cmake's built-in testing facilities
- Creating C++ integration tests to exercise the entire backend under various conditions, including
- The "happy path" (e.g. getting a valid web page like https://google.com/)
- Sending requests to non-existent locations (e.g. "http://imprettysurethiswebsitedoesntexist.com/")
- Invalid URLs (i.e. bang on your keyboard)
- Making sure cookies and headers are actually set
- streaming and timeouts