EllisLab text mark
Advanced Search
     
Unit testing & ExpressionEngine
Posted: 20 December 2009 01:11 PM   [ Ignore ]
Avatar
Joined: 2007-02-11
546 posts

I see that EE 2.x is shipped with CodeIgniter’s unit testing class (CI_Unit_test). I was wondering if anyone have experience in using this to test EE addons.

It does not seem to be used anywhere right now, atleast not in the source that is distributed.

How would you use it? I’m thinking maybe having a seperate page in the modules’ control panel which run unit tests. That should be pretty simple; but what could one unit test there? I guess the mcp.file is already loaded, so those functions could be tested - but how about the mod.file itself and maybe the ext.file (extension) as well. I’m just thinking out loud here, I was just wondering if anyone has some input on this smile

 Signature 

bybjorn.com: ExpressionEngine Freelancer - Premium ExpressionEngine 2.0 Themes - WDA: ExpressionEngine Add-ons - contact me on twitter: twitter.com/bjornbjorn - Zerply profile: zerp.ly/bjornbjorn

 
Posted: 28 June 2010 04:47 AM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Joined: 2009-11-11
15 posts

Bump. I wanted to start my own thread about this but found this one.

Recently I’ve been developing many modules and extensions for various projects in 1.6 and as my modules increasingly complex it’s becoming more and more difficult and inaccurate to do manual tests (especially when your modules rely on a situational response where I have to reset conditions for every test).

Most of my debugging includes a lot of “print_r($var); exit;” and refreshing the page (often re-posting any post data). This gets tricky in situations when you want your module to perform 3 or 4 changes in the database that then have to be ‘undone’ so that you can redo the test. Gosh!

Any developer out there have tips or advice (both general PHP and EE specific) for debugging/testing methods that are repeatable?

(@Bjørn, I also watched your screencast for EE Devkit this morning… can’t wait to move to EE 2.0 to start using nifty tools like that… great stuff)

 
Posted: 12 July 2010 12:28 PM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2006-12-04
515 posts

You should be able to test pretty much anything. In the past I always used it to test modules, helpers, etc. But I do not believe you would be able to test the mod or ext files. I am in the process of setting this up now so if you have any interest in the finished result let me know and I can pass it on.

 Signature 

————————
Eric Barnes | Twitter
————————