JBehave + Serenity metafilter在示例表行上工作?如何解决它?

时间:2015-12-10 15:19:10

标签: java bdd jbehave serenity-bdd

我使用示例表和元过滤器进行的测试并不想启动。 我使用的是jbehave-core 4.0.4和serenity 1.1.21

我有以下场景(此处简化但也有类似问题)

Meta:
@env any
@run

Scenario: Add new logo by Role (test)
Given I am on soccer home page
When I login as "<login>" with "<password>" password
Examples:
| login                                 | password |
| {{site.executive.username::property}} | {{site.executive.password::property}} |
| {{site.webmaster.username::property}} | {{site.webmaster.password::property}} |

我正在使用以下命令来运行测试

verify -Dmetafilter=+run

我正在使用这个&#34; @ run&#34;在本地计算机上运行测试的标记。但是这个命令并没有让我遇到上述情况。输出是&#34;成功&#34;但输出有:

Scenario: Add new logo by Role (test)
Failed to run story stories/club/ClubSetups1.story
java.lang.NullPointerException
    at org.jbehave.core.embedder.PerformableTree$PerformableScenario.perform(PerformableTree.java:876)
    at org.jbehave.core.embedder.PerformableTree$PerformableStory.performScenarios(PerformableTree.java:804)
    at org.jbehave.core.embedder.PerformableTree$PerformableStory.perform(PerformableTree.java:777)
    at org.jbehave.core.embedder.PerformableTree.performCancellable(PerformableTree.java:409)
    at org.jbehave.core.embedder.PerformableTree.perform(PerformableTree.java:380)
    at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:291)
    at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:265)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
12 stories excluded by filter: +run -ignore

奇怪的是,如果我添加&#34; Meta:&#34;列&#34; @ run&#34;每行测试的值都很好。所以我认为metafilter适用于示例表,即使在表没有&#34; Meta:&#34;从我的角度来看这是错误的。

可能有人建议解决方案,因为现在除了添加这个&#34; Meta:&#34;之外我什么都看不到。柱。但这很糟糕,因为我必须复制我拥有的所有参数。

1 个答案:

答案 0 :(得分:0)

查看是否还原到以前版本的jbehave有帮助。 4.0.4似乎有一个错误。看到这个链接 https://groups.google.com/forum/#!topic/jbehave-dev/7OxwmOXZPVk