Some help for Unit Testing, part II |
[eluser]t'mo[/eluser]
[quote author="redguy" date="1208195591"]I'm originally a Java developer, and there I use JUnit to run my test-cases. I couldn't do what I wanted to do with the Unit Testing class in CI... I call the following method from within an index() in a test controller (so I can access it with my browser)... I'm thinking about of putting the $this->unit->result() of every test-case into 1 Array, so I can make my own test-suite. If I pass that test-suite to unit_test_report() I can (kind of) automate my unit testing. By the way, I'm sure my PHP can be improved, I've just started a few months ago so I don't know every in and out of the language.[/quote] I know what you mean about things JUnit can do that CI's Unit Testing class can't (yet) do. That's why I started this series of posts. I ended up doing similar things that you have done(showing red/green bars in the browser, hence an "index()" method, etc.). Did you see my first post on this topic? ;-) As far as how much "improvement" PHP needs, I, like you, don't have a long history with the language. I'm still trying to differentiate what works best with straight PHP code vs. what works best in a library or a framework. The fact is that CI has the Unit Testing class. Maybe this is good, and the responsibility belongs with CI, but maybe it's not, and testing-specific things ought to be factored out to a separate library. (E.g., in Java, JUnit is not part a web framework, such as Struts.) There are other unit-testing libraries for PHP, but for now, I'm using the Unit Testing class, because it's there, and because with a little help, it's worked out well. |
Messages In This Thread |
Some help for Unit Testing, part II - by El Forum - 04-14-2008, 12:23 AM
Some help for Unit Testing, part II - by El Forum - 04-14-2008, 06:53 AM
Some help for Unit Testing, part II - by El Forum - 04-14-2008, 10:28 AM
Some help for Unit Testing, part II - by El Forum - 04-15-2008, 12:08 AM
Some help for Unit Testing, part II - by El Forum - 04-15-2008, 08:10 PM
Some help for Unit Testing, part II - by El Forum - 04-20-2008, 12:33 PM
Some help for Unit Testing, part II - by El Forum - 01-17-2009, 10:42 PM
Some help for Unit Testing, part II - by El Forum - 01-17-2009, 10:49 PM
Some help for Unit Testing, part II - by El Forum - 01-18-2009, 04:18 AM
|