unit testing sakai

Tue, Sep 18, 2007

I’ve spent the entire day trying to figure out how to write unit tests for Sakai. There’s a test harness, which nothing seems to use as other components just cannibalise it and do it their own way.

So, in the best spirit of Sakai, I cannibalised it too, with the ultimate aim of simulating a user uploading a resource. But I’ve been banging my head against a brick wall all day. Eventually I managed to get to the point of using a WebappClassLoader with all the Sakai jars added to it via addURL but when I load the SpringCompMgr I still get class not found errors:

[/Users/alistair/dev/sakai/tomcat/apache-tomcat-5.5.23/components/000sakai-portal-service-pack/WEB-INF/components.xml] Bean ‘org.sakaiproject.portal.api.PortalService’; nested exception is java.lang.NoClassDefFoundError: org/sakaiproject/portal/api/PortalService Caused by: java.lang.NoClassDefFoundError: org/sakaiproject/portal/api/PortalService

I’ll need to think about this as it’s undocumented how to test Sakai. The test harness adds jars to the classloader while most other versions of that harness don’t. Either way, the one I have doesn’t work. Looks like I’ll have to spend another day or two on the problem.

I’d rather not progress with CTREP core code until I can find out how to actually test the stuff.

comments powered by Disqus