You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Evgeny Bogdanov <ev...@epfl.ch> on 2012/01/31 13:12:06 UTC

Re: Buggy behavior with tests in EndToEndTest.java

Well,
the problem is basically caused by the last line in testframework.js
95: gadgets.util.registerOnLoadHandler(executeTest);

if gadget file requires "opensocial-0.9", alerts in executeTest are 
collected by Java,
but as soon as gadget requires "osapi", the alerts are not collected 
anymore.

If I call executeTest manually at the end of personTest.xml,
it starts to work.

Seems as there is a problem with synchronization between
gadgets.util.registerOnLoadHandler and alertHandler.getCollectedAlerts()

On 31.01.12 09:40, Evgeny Bogdanov wrote:
> Hi all,
>
> I ran into a problem with JS API tests in shindig.
>
> It seems that it does not gather the tests asserts correctly in 
> EndToEndTest.java.
> I run test with the following command:
> mvn -Dtest=EndToEndTest -DfailIfNoTests=false test -P server
>
> The scenario:
> 1. Default shindig - SUCCESS
>
> 2. If I only change in the file: fetchPersonTest.xml
> line 43: "Shin Digg" to "Shin Dig"
> FAILURE
>
> in logs:
> --------------------
> INFO: sanityCheckAst
>   fetchPerson(org.apache.shindig.server.endtoend.EndToEndTest): test 
> method fetchId did not finish
> Jan 31, 2012 9:15:34 AM 
> com.google.javascript.jscomp.PhaseOptimizer$NamedPass process
> INFO: sanityCheckVars
>
> Tests run: 30, Failures: 1, Errors: 0, Skipped: 7
> --------------------
>
> 3. If I only change in the file: personTest.xml
> line 34: "Shin Digg" to "Shin Dig"
> SUCCESS,
>
> in logs:
> --------------------
> Jan 31, 2012 9:08:06 AM 
> com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl 
> runSingleJob
> SEVERE: Job run failed with unexpected RuntimeException: 
> assertEquals() failed: Names don't match - 
> {"id":"canonical","displayName":"Shin Digg"}
> Expected "Shin Dig", was "Shin Digg" 
> (http://localhost:9003/gadgets/concat?container=default&gadget=http%3A%2F%2Flocalhost%3A9003%2Fosapi%2FpersonTest.xml&debug=0&nocache=1&type=js&1=http%3A%2F%2Flocalhost%3A9003%2Ftestframework.js#37)
> ======= EXCEPTION START ========
> Exception 
> class=[net.sourceforge.htmlunit.corejs.javascript.JavaScriptException]
> com.gargoylesoftware.htmlunit.ScriptException: assertEquals() failed: 
> Names don't match - {"id":"canonical","displayName":"Shin Digg"}
> Expected "Shin Dig", was "Shin Digg"
> --------------------
>
> So in the last case, even though exception did happen, it has
> different format from second case and not processed correctly to give 
> a Failure.
>
> Any idea what is causing it or how to fix it?
>
> Best
> Evgeny
> .
>