Hello everyone
I am learning Rust by writing a little tool which I can pass a config-file. I've written a little (black-box) integration test and placed it within the "tests" folder as well as a sample-config file. Now I would like to access this file relatively. Currently I use
Path::new("../../tests/myfile")
because I've expected the test is started from /target/debug but this doesn't work. Specifying the absolute path works of course.
Coming from Java where Maven and Gadle actually copy the test-resources to the target folder next to the binary, I can easily access the test-resources with a relative path during a test without having to know how the target directory is structured. Is there something similar possible with Cargo? Or do I have to use another API to load the file?
I've read many articles about testing in rust, but none actually covered this integration-test topic with additional resources.
Thanks