我正在開發一個應用程序,並在我的硒測試中使用多個標記來完成重複任務。兩個標籤:播放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。
測試/硒/ AddCard.test.html
*{ Tests adding a simple card }*
#{loginAs login:'[email protected]', password:'foobar' /}
#{selenium}
open('@{Application.index()}')
... more selenium stuff here
#{/selenium}
唯一的例外是:
切換播放1.2.2後,我運行使用loginAs硒測試時,出現以下情況例外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
當我刪除了#{如果_keepData!}調用braindumpFixture圍繞我得到的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中的標籤是否發生了根本性的變化,我只是在文檔中忽略了它,或者這可能是一個錯誤。任何解決這個謎題的想法都是受歡迎的。
我們能看到這一點:在/test/selenium/AddCard.test.html.(line:3)? –
我加了。它只是調用該行中的標籤。 –