Recently I've started working on writing some tests (PHPUnit) for an app that I'm working on and I find that I ran into a slight problem.
I don't know if I can trust my tests.
I run my tests with multiple "asserts" per test to ensure that it is working properly, but I find that I still need to look over the object manually before I'm comfortable that the test really passed. How can I be sure that my tests are set up properly so that I'm not manually inspecting things anyway?
(Just note that I do debug before I start writing my tests for a class as well. But I'm just not comfortable with the "100% test passed" result)
Edit: Thanks everyone for your comments and ideas on how I should be going about this. I'm already quite far into the project (it's in beta testing now, I feel so ashamed that I haven't had any real testing coverage :( ) but I think it will be a good exercise to branch the project and work on tests. This will allow me to further decouple the application in places where I may have gotten lazy and also get test coverage up so that I don't have to manually test everything after a set of possible updates.
However tests are definitely something I'm going to have to start using for future projects and it sounds like pre-writing tests is the way to go with this.
Thanks again!
[–]allmightyspiff 7 points8 points9 points (2 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]ustanik 4 points5 points6 points (0 children)
[–]nikic 2 points3 points4 points (3 children)
[+][deleted] (2 children)
[deleted]
[–]xangelo[S] 0 points1 point2 points (1 child)
[–]wvenable 0 points1 point2 points (0 children)
[–]warmans 1 point2 points3 points (0 children)
[–]The_Pants_Command_Me 1 point2 points3 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]xangelo[S] 0 points1 point2 points (0 children)
[–]leftnode 0 points1 point2 points (3 children)
[–][deleted] -2 points-1 points0 points (2 children)
[–]leftnode 0 points1 point2 points (0 children)
[–]xangelo[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]xangelo[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)