To test my WebScripts that live on the Repository side, I've been following the approach on the <a href="http://wiki.alfresco.com/wiki/3.0_Web_Scripts_Testing">WebScript Testing wiki page</a>. This involves having your test class extend from BaseWebScriptTest. Apart for missing a few of the nice bits of JUnit 4 Rules that the pure-service unit test seem to have available to them, it works fine.
Now I find myself wanting to unit test some WebScripts that live on the Share tier. BaseWebScriptTest doesn't seem to be an option, as that automatically brings up the Repository web application, and I need to test my WebScript in Share. I've tried looking at the Alfresco source tree, but I couldn't seem to track down any WebScript unit tests targetting the Share tier.
Is there a recommended way to do this? Is there a different class I can extend from? Do I need to subclass something like BaseWebScriptTest and try to load the Share context files instead? Is there anything in Surf that'll help?
i'm using org.alfresco.repo.web.scripts.BaseWebScriptTest to junit my repo (/alfresco/service/…) webscripts. The class disappeard from alfresco-remote-api jar from version 4.2.d; last working version is 4.2.c community; I didn't find any information right now. Any idea?
There are some basic automated WebScript tests in the FVT test suite for Surf (which is effectively the same environment Share is running in)… it uses TestNG via Maven to launch a test Jetty app and uses makes requests to WebScripts and checks the response is as expected. It's pretty crude but is at least an example of testing WebScripts.