Skip to content

Commit 47bf9ec

Browse files
authored
Update to 5.x (#23)
This PR aims to upgrade Cucumber dependency to 5.X, actually 5.6.0. **Content:** - update code to be compatible with Cucumber 5.6.0 - added some tests (mainly copied from Cucumber Java) - add documentation in README about major changes: - move all classes under `io.cucumber.scala` to be more consistent with Cucumber Java - parameters change in Before/After hooks to be consistent with Cucumber Java - upgrade Scala versions, Scala Maven plugin and Groovy The breaking changes are open to discussion but I feel: - it helps convey the idea that there is major changes with the upcoming 5.x release (I would like to include the fix for #1 as well, PR coming soon...) - it makes Cucumber Scala more consistent with Cucumber Java and will ease developers to contribute
1 parent 0322e09 commit 47bf9ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1547
-839
lines changed

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,44 @@ To use cucumber-jvm-scala in your project, add the following dependency to your
2424
<scope>test</scope>
2525
</dependency>
2626
```
27+
28+
## Compatibility matrix
29+
30+
The Cucumber Scala version matches the Cucumber version except for the bugfix number
31+
which can be different.
32+
33+
| Cucumber Scala version | Cucumber version | Scala versions |
34+
|------------------------|------------------|------------------|
35+
| 5.6.0 | 5.6.0 | 2.11, 2.12, 2.13 |
36+
| 4.7.1 | 4.7.1 | 2.11, 2.12, 2.13 |
37+
38+
## Migrating from 4.x to 5.x
39+
40+
If you are using Cucumber Scala 4.7.x and want to upgrade to 5.x, please note there are some major changes in addition to the Cucumber upgrade itself.
41+
42+
### Packages
43+
44+
All Cucumber Scala classes are now under `io.cucumber.scala` package instead of `cucumber.api.scala`.
45+
46+
### Before/BeforeStep/After/AfterStep definitions
47+
48+
The `Before`, `BeforeStep`, `After` and `AfterStep` definitions have slightly changed:
49+
- to apply only with some tags, the variable list of tags as `String*` is replaced by a single tag expression of type `String`.
50+
- if providing both an order and a tag expression, the order is now the second parameter instead of the first.
51+
This is more consistent with the Java implementation.
52+
53+
For instance, the following code:
54+
55+
```scala
56+
Before(1, "@tag1", "@tag2") { _ =>
57+
// Do Something
58+
}
59+
```
60+
61+
Is replaced by:
62+
63+
```scala
64+
Before("@tag1 or @tag2", 1) { _ =>
65+
// Do Something
66+
}
67+
```

examples/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>io.cucumber</groupId>
66
<artifactId>cucumber-jvm-scala</artifactId>
7-
<version>4.7.2-SNAPSHOT</version>
7+
<version>5.6.0-SNAPSHOT</version>
88
</parent>
99

1010
<artifactId>scala-examples</artifactId>

examples/src/test/scala/cucumber/examples/scalacalculator/RpnCalculatorStepDefinitions.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package cucumber.examples.scalacalculator
22

3-
import cucumber.api.Scenario
4-
import cucumber.api.scala.{ScalaDsl, EN}
3+
import io.cucumber.scala.{EN, ScalaDsl, Scenario}
54
import org.junit.Assert._
65

76
class RpnCalculatorStepDefinitions extends ScalaDsl with EN {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package cucumber.examples.scalacalculator
22

3-
import cucumber.api.CucumberOptions
3+
import io.cucumber.junit.{Cucumber, CucumberOptions}
44
import org.junit.runner.RunWith
5-
import cucumber.api.junit.Cucumber
65

76
@RunWith(classOf[Cucumber])
7+
@CucumberOptions()
88
class RunCukesTest

0 commit comments

Comments
 (0)