cancel
Showing results for 
Search instead for 
Did you mean: 

Unit testing Share WebScripts?

nickburch
Confirmed Champ
Confirmed Champ
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?
4 REPLIES 4

aitbenmouh
Champ in-the-making
Champ in-the-making
Im too looking for this, the way explained in the wiki is not complet and not clair we need a another solution to test webscripts.

zladuric
Champ on-the-rise
Champ on-the-rise
There was a post few days ago about testing, maybe you can find some insight there:
http://forums.alfresco.com/comment/133803

fabio_valeri
Champ in-the-making
Champ in-the-making
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?

ddraper
World-Class Innovator
World-Class Innovator
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.