gpt4 book ai didi

java - 在 JBehave 中使用多个元过滤器进行过滤

转载 作者:太空宇宙 更新时间:2023-11-04 08:08:00 24 4
gpt4 key购买 nike

情况:

在我当前的项目中,我们正在运行各种不同的 JBehave 故事。每个“.story”文件都与一个产品和一个流程相关。

示例:
xyz-cellphone-call.story 将是描述用手机调用电话的故事。
xyz-phone-call.story 是描述使用固定电话调用电话的故事。
xyz-cellphone-browse.story 将是描述使用手机浏览互联网的故事。

我的问题:在 Jbehave 中,您可以添加元过滤器以根据元标记过滤故事。假设标签是@product & @action。 (@产品手机,@行动电话)。
是否可以通过一个过滤器来运行有关电话和手机故事的 JBehave 故事,如果可以,语法是什么?

我尝试添加以下过滤器(都不起作用):

+product cellphone +product phone
+product cellphone|phone
+product cellphone,phone

操作也是如此。

是否可以过滤多个元标记?

最佳答案

是的,这是可能的。在 API 文档中,您将找到以下信息:

A filter is uniquely identified by its String representation which is parsed and matched by the MetaFilter.MetaMatcher to determine if the Meta is allowed or not.

The MetaFilter.DefaultMetaMatcher interprets the filter as a sequence of any name-value properties (separated by a space), prefixed by "+" for inclusion and "-" for exclusion. E.g.:

MetaFilter filter = new MetaFilter("+author Mauro -theme smoke testing +map *API -skip"); filter.allow(new Meta(asList("map someAPI")));

The use of the MetaFilter.GroovyMetaMatcher is triggered by the prefix "groovy:" and allows the filter to be interpreted as a Groovy expression.

MetaFilter filter = new MetaFilter("groovy: (a == '11' | a == '22') && b == '33'");

因此,如果您考虑这些条件,您可能会自定义运行配置。试试这个例子:

mvn clean install -P -Djbehave.meta.filter="myCustomRunConf:(+product && +action)"

API 文档中有关 MetaFilter 类的更多信息: http://jbehave.org/reference/stable/javadoc/core/org/jbehave/core/embedder/MetaFilter.html

关于java - 在 JBehave 中使用多个元过滤器进行过滤,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11742151/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com