Closed oanhnn closed 8 years ago
IMHO yes, its always good to include a test that people can use as a reference design.
Run tests on the API codebase? I have no test experience with Slim (or API's for that matter) and i wonder how to test the API endpoints, if their backend is stateful? (a filesystem, a database, and in my case both and then some)
I know of no easy way to facilitate this without actually spawning a DB instance. Another thing is that each test (or battery of tests) should be able to start out with a given dataset. Creating all these DB instances might not be performant or practical..
Run API tests on a contained environment as a whole? This brings me back to the idea that perhaps most testing would take place not on this API codebase, but on the environment that its used in as a whole. I'm not there yet, but i can imagine there's people doing this using visualization they already use for production. (e.g. VM's or Docker containers?)
Insights welcome!
I've made an attempt to write WebTestCase, inspired by Silex. It's actually possible since Slim 3.1 version fixes slimphp/Slim#1688 issue. Would you be interested if I open-source that?
I agree. I think this would be beneficial for everyone. I don't see any reason to not include it. I do believe that an example functional test would also be useful to extend off of as well. Similar to what @adambro mentioned, creating a WebTestCase.
And..? As a newbie, I vote for this too!
I have taken a stab at this, and will send a pull request imminently. :)
Should we add
tests
directory and an example for test