Skip to content

Commit 0404bce

Browse files
Copilotgaeljw
andcommitted
Add tags filter support and remove junit-platform.properties
Co-authored-by: gaeljw <18280708+gaeljw@users.noreply.github.com>
1 parent 80fbe29 commit 0404bce

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

cucumber-scalatest/src/main/scala/io/cucumber/scalatest/CucumberSuite.scala

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@ import scala.annotation.nowarn
1414
* packages containing step definitions (e.g., "com.example.steps")
1515
* @param plugin
1616
* plugins to use (e.g., "pretty", "json:target/cucumber.json")
17+
* @param tags
18+
* tag expression to filter scenarios (e.g., "@foo or @bar", "not @wip")
1719
*/
1820
case class CucumberOptions(
1921
features: List[String] = List.empty,
2022
glue: List[String] = List.empty,
21-
plugin: List[String] = List.empty
23+
plugin: List[String] = List.empty,
24+
tags: Option[String] = None
2225
)
2326

2427
/** A trait that allows Cucumber scenarios to be run with ScalaTest.
@@ -120,6 +123,13 @@ trait CucumberSuite extends Suite {
120123
builder.addPluginName(p)
121124
}
122125

126+
// Add tags filter if specified
127+
cucumberOptions.tags.foreach { tagExpression =>
128+
builder.addTagFilter(
129+
io.cucumber.tagexpressions.TagExpressionParser.parse(tagExpression)
130+
)
131+
}
132+
123133
builder.build()
124134
}
125135
}

examples/examples-scalatest/src/test/resources/junit-platform.properties

Lines changed: 0 additions & 4 deletions
This file was deleted.

examples/examples-scalatest/src/test/scala/cucumber/examples/scalacalculator/RunCukesTest.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@ class RunCukesTest extends CucumberSuite {
77
features = List("classpath:cucumber/examples/scalacalculator"),
88
glue = List("cucumber.examples.scalacalculator"),
99
plugin = List("pretty")
10+
// Example with tags filter (commented out):
11+
// tags = Some("@foo or @bar") // Run scenarios tagged with @foo or @bar
12+
// tags = Some("not @wip") // Skip scenarios tagged with @wip
1013
)
1114
}

0 commit comments

Comments
 (0)