-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unit Tests #67
Comments
I'll write up some possible fixes while writing unit tests, just reminders for ourselves in the future. My goal is to fix them after the tests for the current code.
|
Oops, didn't noticed @nickl- already started testing some things. Hey @nickl-, feel free to move any tests you want from I've started the tests using some conventions on tests, we should discuss them:
The idea is that each line on the testdox output should be descriptive enough to say how a specific unit behaves and what is being tested. I've also added messages to all I'm also exploring a nice idea from last night. We should be able to use test dependencies and data providers to explore combinatory tests (seems like the right choice for testing Routines, for example). It's a simple idea: a test is populated by a data provider, then another test is declared as dependent of the first one. For each provided data on the first, the second should run. I hope PHPUnit allows that someday, experiments so far on PHPUnit 3.6 were unsuccessful. |
BTW, I'm starting with the tests for the Request class: https://github.com/Respect/Rest/blob/develop/tests/library/Respect/Rest/RequestTest.php |
Found these notes on PHPunit manual:
http://www.phpunit.de/manual/3.6/en/writing-tests-for-phpunit.html |
Finished the tests for the Request class with 100% code coverage (no side effects, always using mocks). I've added a lot of helpers to create mocks and generators. Maybe these mocks could be reused in another tests, perhaps we should create something that extends the PHPUnit_Framework_Testcase. |
I've commited some annotations for PHPunit, phpDocumentor (maybe, not sure) and Respect\Doc. Please see this issue guys: Respect/Doc#16 |
@alganet quoted phpunit documentation referring to @Depends. I also had exactly the same idea as you when I stumbled on this @Depends:
But alas it doesn't do any of that if anything at all as I couldn't even be sure that it actually runs test b before a. Also set-up and tear down does not work as previously advertised anymore and as far as the data providers go they seem to be loaded even before setup so you cannot even rely on the state. I think wrapping is a good idea:
We will need to ensure that it still runs as standard or configurable to include the custom wrappers from within the standard library I would imagine but the more control we can get for phpunit the better. I was also unable to make the --filter option work, for running a single test. I am not sure what is going on there. Differences between the text and html reports etc are the rewriting the tool or what? |
We currently don't have real unit tests, our tests are more functional/BBDish. I'm gonna write the proper units and keep the old tests as legacy, already started!
The text was updated successfully, but these errors were encountered: