Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd integration tests for examples #777
Comments
killercup
added
good first issue
help wanted
tests
labels
Mar 4, 2017
This comment has been minimized.
ivan-brko
commented
Apr 2, 2017
|
Hi, I'd like to get familiar with this project so I want to help with this issue. This could be written as a Rust integration test or is something like .py script for each backend more preferable? |
This comment has been minimized.
cgm616
commented
Apr 20, 2017
|
I'm interested in this issue because I'm trying to figure out how to test my own application that uses diesel. Will I have to run my own CI server with a DB to connect to and verify after every command? There has to be a better way. Hopefully tests in the examples will give me an idea. |
This comment has been minimized.
heyztb
commented
Oct 5, 2018
|
Since there hasn't been any activity on this since 2017, I'd like to tackle this issue |
This comment has been minimized.
|
@heyztb sure, go for it! Maybe open a PR with a rough idea what you want to test and then iterate on that? This way, we can give you feedback as early as possible. Alternatively, feel free to ask questions here or (preferred) on Gitter. |
This comment has been minimized.
heyztb
commented
Oct 5, 2018
|
@killercup - Sounds good. I'll open a PR once I've got a tentative test up and running. I'm going to work on the Postgres example first, mainly because I'm not sure exactly which library I need to install in order to work with MySQL (I'm on macOS Mojave, btw). I do have a question, and I figured this would be an appropriate place to ask but I'm also going to link this issue to the Gitter channel and get some feedback there - I understand that this issue asks for Integration tests, and I've taken a look at the assert_cmd crate, but I'm not too sure how I'd pass in arguments to the various binaries. I'd rather the tests not require actual user input, and I would like to simulate that instead. My question is, how do I go about passing in things like the title and body of a post in my tests? There's no straightforward way from what I can tell, so are we sure that unit tests aren't more appropriate for this? Thanks for the help. I look forward to contributing more! |
This comment has been minimized.
|
@heyztb cool! Very good question regarding the interativity! I actually totally forgot about that. It would be nice to test that, but it's totally fine to start with unit tests: We are trying to make sure the diesel examples are fine, not that In my capacity as author of assert_cli and CLI working group lead, I am very interested in making sure we can write those tests, however! There is assert-rs/assert_cmd#28 which tracks this in some fashion. For all things CLI (testing or otherwise) you are also very welcome to join https://gitter.im/rust-lang/WG-CLI (or |
killercup commentedMar 4, 2017
We currently have the app from the Getting Started guide implemented for all backends, but there are no tests to ensure they all behave the same.
The app implements several simple binaries to create/display/publish/delete posts. Writings some tests that interact with all the binaries and assert their output is good would be great (it doesn't even have to cover all failure cases).
I wrote the assert_cli crate for a similar use-case. There might be better crates for that now, though. Or actually, it might be possible to do that in a shell script. (Don't know how well that works on Windows, though.)