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

[eluser]drizz815[/eluser]
I'd like to know what people think about testing code. I've been using the Test Driven Development technique to catch bugs as I work and as an aid to the development process. I've gotten used to SimpleTest and was expecting to be able to continue using it when I changed to CodeIgniter. However, I just can't get CodeIgniter and SimpleTest to work together. I've found two solutions in these forums but neither have provided a solution that works for me. My programming skills are pretty pedestrian and I certainly wasn't able to work it out for myself so I've decided, with a great deal of reluctance, to abandon CodeIgniter and all the hours I've invested in trying to get it to work.

People must, surely, test their apps. The CI Unit testing class seems to me too basic a solution if you want to finish up with a test harness for an app.

What do people do?
#2

[eluser]webthink[/eluser]
Unit testing is great. I wish I had the time to implement it for our applications. Unfortunately that's the problem... It requires an investment of time that I don't think We'd be able to talk any of our clients into. I understand the value of a properly implemented test suite because I've used it in the past. Unfortunately not with CI though. It's a bit troubling to hear you had such a problem getting simpletest to work with CI. Hopefully someone will chime in and tell us that it's at least possible.
#3

[eluser]Neophyte[/eluser]
[quote author="webthink" date="1207314985"]Unit testing is great. I wish I had the time to implement it for our applications. Unfortunately that's the problem... It requires an investment of time that I don't think We'd be able to talk any of our clients into. I understand the value of a properly implemented test suite because I've used it in the past. Unfortunately not with CI though. It's a bit troubling to hear you had such a problem getting simpletest to work with CI. Hopefully someone will chime in and tell us that it's at least possible.[/quote]

Last time i used SimpleTest with CI it was just a case of uploading it somewhere easilly accessible (such as the libraries folder) and then including the files needed to run your test cases.

I guess what might be handy for faster testing is an CI application which includes SimpleTest and looks for 'test' folders which could then be used with say Matchbox as a module.
#4

[eluser]adamp1[/eluser]
As I code I test it, I suppose that's why I take longer to write programs sometimes.

Do other people say write an entire controller with models and views and then test it? Or test each bit as they go along?

I have to admit proper testing is just something I haven't started doing. Heck I only just lately thought about explaining my code in documentation, that's very hard.
#5

[eluser]Neophyte[/eluser]
In a perfect world with all the time i could ever want i would do a proper analysis and design then write appropriate test cases then finally write the code in reality theres barely enough time to do the code nevermind proper designing or unit testing heh
#6

[eluser]John Fuller[/eluser]
You might specify exactly what your problem is. Did you have a problem getting SimpleTest to work? Did you get it working but had some other issue with it? Details please.
#7

[eluser]drizz815[/eluser]
John, I started working as Neophyte describes but that just doesn't work. I'm not yet that familiar with CI but you can't just include say a CI model file and expect to be able to test what it does the way you can when working outside CI.

I tried using the SimpleTester wrapper I found in the Wiki. I got that set up properly (the sample files worked). However, it works through the front controller which I didn't like. So then I tried the solution posted by Don Pinkster at http://ellislab.com/forums/viewthread/63602/. This ran the tests outside the application (that is, the tests only ran when you fed the test URL into the browser), it created an instance of CI within the tests but when I did it SimpleTest reported Bad Tests, no valid tests. Granted there may have been something amiss with my code, but I've been using SimpleTest for a while, tried lots of things to make it work. I could not for the life of me see why, if I could get it working well enough to generate that error, I couldn't get it to work properly.

I then went back to the SimpleTester wrapper, but if I included a model file, I got CI's error message about not allowing direct access. I had a go at trying to work out from scratch what one had to do but I'm far from being a brilliant coder and gave up when I ran into CI's no direct access message.
#8

[eluser]Unknown[/eluser]
That was exactly why I've abandoned CI a couple years ago in favor of CakePHP.
No having the ability to test a code is serious no go for an app.
BUT, CI is much faster then Cake and if you have to throw out a mainly informational website use CI.
#9

[eluser]drizz815[/eluser]
ZeRUS - thanks. I'm still hoping somebody has a workable solution. I'd read that CI was fast and well documented - two key reasons for choosing it.
#10

[eluser]t'mo[/eluser]
I have been trying to use CI's Unit Testing class -- but had to make a few improvements in how I use it. See http://ellislab.com/forums/viewthread/76186/ .




Theme © iAndrew 2016 - Forum software by © MyBB