Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter abandoned - Unit Testing issues
#11

[eluser]drizz815[/eluser]
t'mo thanks - that looks useful. I've book marked it and will have a go. Am I right in thinking that you finish up with a test file per model, each test starts with "test" (you can add helper functions), and you run each test file separately from the browser?

What do you do about setUP and tearDown? My current test harness is resetting my test DB with sample data so I can test for successful changes.

How do you test your user interface?
#12

[eluser]t'mo[/eluser]
[quote author="drizz815" date="1208000467"]Am I right in thinking that you finish up with a test file per model, each test starts with "test" (you can add helper functions), and you run each test file separately from the browser?

What do you do about setUP and tearDown? My current test harness is resetting my test DB with sample data so I can test for successful changes.

How do you test your user interface?[/quote]

Q1: Yes.

Code:
class FooTest extends MY_TestController
{
  ...
  function test_SomethingOrOther() {
    // this code will be invoked by MY_TestController::index()
    ...
  }
  ...
  function non_test_code_may_be_a_helper() {
    // this code will *not* be invoked by MY_TestController::index()
  }
  ...
}

About running each test file in a browser, I'll have more on that in Part II (when I get around to writing it...but in case I never do, I basically put my test files under 'application/controllers/test/', and run them all from the command line).

Q2: I don't really have a setUp/tearDown. I think CI's unit testing class ought to provide that (not unlike how JUnit provides those methods), and I just haven't gotten around to writing my own.

Q3: Unfortunately, I don't (yet).
#13

[eluser]drizz815[/eluser]
t'mo, I await your "part 2" with interest!

With thanks and best wishes.
#14

[eluser]t'mo[/eluser]
Part II is out there.

Your questions about interface testing have spurred some more thought, and there is a part III in the works (if I can successfully translate my ideas from Perl to PHP).
#15

[eluser]drizz815[/eluser]
Brilliant! Thank you.

By the way, I am on Windows (I need to be for some things), never mind...




Theme © iAndrew 2016 - Forum software by © MyBB