mercredi 22 juillet 2009

Grails - App Engine - How to test my App?

That's a good question no?

I don't like make by hand that a computer did for me at better cost so I'm using to deeply test my code. With the app-engine plugin, the command grails test-app doesn't work any more because of JDO class not found problem

java.lang.NoClassDefFoundError: javax/jdo/JDOException
I hope adding the jar jdo2-api-2.3-ea.jar coming from the google sdk (see T:\appengine\1.2.2\lib\tools\orm) is sufficient. Let's try again. There is another error about Spring.

Because it was an integration test coming from an existing project, I try to create an integration Test from the command grails create-integration-test, just to see if the plugin modify the template for them. The answer is no.

Because I'm starting to understand that I have to forget many things which made the simplicity of Grails like object.save() Object.findByXXX() ... I try to write my test by following the template of the contoller by using the persistenceManager.

The result is the same.
gant.TargetExecutionException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'persistenceManagerFactory' while setting bean property 'persistenceManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'persistenceManagerFactory': Invocation of init method failed; nested exception is javax.jdo.JDOFatalUserException: A property named javax.jdo.PersistenceManagerFactoryClass must be specified, or a jar file with a META-INF/services/javax.jdo.PersistenceManagerFactory entry must be in the classpath, or a property named javax.jdo.option.PersistenceUnitName must be specified.

Well,well, the javax.jdo.PersistenceManagerFactoryClass is defined inside the jdoconfig.xml file. I have to find how to load it before the test starting:)


Badly, where are no advice about how testing an application running on GAE. Even the pet-clinic sample app doesn't have integration test.
Greame tests only the controller. (and during the time I'm testing the application, I get 2 server Error)

Hum maybe I should better see how Python works.....

1 commentaire:

  1. Python have no easy-to-handle unit test frameworks for GAE either. Btw I'd like to know, if there are any solutions now. I've checked for GAE/Python unit test solutions many months ago....

    RépondreSupprimer