2011-08-09 10 views
1

私はプレイ中のアプリケーションを開発しています。セレンテストでは、繰り返しタスクにいくつかのタグを使用します。二つのタグは以下のとおりです。再生1.2.2 - タグ内のタグは許可されなくなりましたか?

アプリ/ビュー/タグ/ loginAs.html

*{ Tag for running selenium tests when being logged in }* 

#{if !_keepData} 
#{braindumpFixture delete:'all', load:'users.yml' /} 
#{/if} 

#{selenium} 
... some selenium code to log into the application 
#{/selenium} 

アプリ/ビュー/タグ/ braindumpFixture.html

%{ 
if(_delete == 'all') { 
play.test.Fixtures.deleteAll() 
} else if(_delete) { 
play.test.Fixtures.delete(_delete) 
} 
}% 

%{ 
if(_load) { 
play.test.Fixtures.load(_load) 
} 
// finally make sure the index is correctly updated. 
new application.jobs.CompleteReindexJob().doJob(); 
}% 

問題ではなく、これらの作業1.1を再生します。 loginAsを使用してセレンのテストを実行するときに1.2.2を再生するために切り替えた後、私は次の例外を取得:

テスト/セレン/ AddCard.test.html

*{ Tests adding a simple card }* 

#{loginAs login:'[email protected]', password:'foobar' /} 

#{selenium} 
open('@{Application.index()}') 
... more selenium stuff here 
#{/selenium} 

例外ビーイング:

play.exceptions.TemplateExecutionException: Cannot get property 'data' on null object 
    at play.templates.BaseTemplate.throwException(BaseTemplate.java:84) 
    at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:252) 
    at play.templates.GroovyTemplate$ExecutableTemplate.invokeTag(GroovyTemplate.java:374) 
    at /test/selenium/AddCard.test.html.(line:3) 
    at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:229) 
    at play.templates.Template.render(Template.java:26) 
    at play.templates.GroovyTemplate.render(GroovyTemplate.java:184) 
    at controllers.TestRunner.run(TestRunner.java:107) 
    at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:543) 
    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:499) 
    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:475) 
    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:470) 
    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:158) 
    at Invocation.HTTP Request(Play!) 
Caused by: java.lang.NullPointerException: Cannot get property 'data' on null object 
    at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:229) 
    ... 12 more 

私はbraindumpFixtureへの呼び出しの周りに#{_keepDataあれば!}を削除すると、私はEmptyStackExceptionを得る:

play.exceptions.TemplateExecutionException 
    at play.templates.BaseTemplate.throwException(BaseTemplate.java:84) 
    at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:252) 
    at play.templates.Template.render(Template.java:26) 
    at play.templates.GroovyTemplate.render(GroovyTemplate.java:184) 
    at controllers.TestRunner.run(TestRunner.java:107) 
    at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:543) 
    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:499) 
    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:475) 
    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:470) 
    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:158) 
    at Invocation.HTTP Request(Play!) 
Caused by: java.util.EmptyStackException 
    at java.util.Stack.peek(Stack.java:85) 
    at java.util.Stack.pop(Stack.java:67) 
    at play.templates.TagContext.exitTag(TagContext.java:31) 
    at play.templates.GroovyTemplate$ExecutableTemplate.invokeTag(GroovyTemplate.java:380) 
    at /test/selenium/AddCard.test.html.(line:3) 
    at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:229) 
    ... 9 more 

Play 1.2のタグで根本的に何かが変わってしまったのか、ドキュメントでは見落としてしまったのか、それともバグかもしれないのかなと思います。この謎を解決するためのアイデアは大歓迎です。

+1

は、我々はこれを見てもらえ:/test/selenium/AddCard.test.html.(line:3で)あなたはフィクスチャタグの修正版を作成することができます回避策として

? –

+0

私はそれを加えました。その行のタグを呼び出します。 –

答えて

1

これは動作を停止するために何かが変更されているはずであることに気づいていないので、これはバグです。

+0

いくつかのライブラリはアップグレードされていますが、後方互換性を損なうものはありません。 –

3

問題は#{fixture}タグです。 ymlファイルをロードするときに内部スタックを強制終了します。 https://play.lighthouseapp.com/projects/57987-play-framework/tickets/1026-using-tags-inside-tags-is-broken-since-play-121#ticket-1026-3を参照してください。

%{ 
    if(_delete == 'all') { 
     play.test.Fixtures.deleteAll() 
    } else if(_delete) { 
     play.test.Fixtures.delete(_delete) 
    } 
}% 

%{ 
    if(_load) { 
     // Workaround (save the stack) 
     stack = play.templates.TagContext.currentStack.get(); 

     play.test.Fixtures.load(_load) 

     // Workaround (restore the stack) 
     play.templates.TagContext.currentStack.set(stack); 
    } 
}% 

%{ 
    if(_arg && _arg instanceof String) { 
     try { 
      play.Play.classloader.loadClass(_arg).newInstance() 
     } catch(Exception e) { 
      throw new play.exceptions.TagInternalException('Cannot apply ' + _arg + ' fixture because of ' + e.getClass().getName() + ', ' + e.getMessage()) 
     } 
    } 
%} 
関連する問題