Skip to content

Commit 13be6ac

Browse files
authored
Merge pull request #42 from cucumber/feature/upgrade-cucumber-5.7
Upgrade to Cucumber 5.7.0
2 parents dbb3f47 + 580a1d6 commit 13be6ac

File tree

9 files changed

+85
-10
lines changed

9 files changed

+85
-10
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,16 @@ See also the [CHANGELOG](https://github.com/cucumber/cucumber-jvm/blob/master/CH
1111

1212
### Added
1313

14+
- [Scala] `Scenario.log(String)` & `Scenario.attach(byte[], String, String)` ([#42](https://github.com/cucumber/cucumber-jvm-scala/pull/42) LINK Gaël Jourdan-Weil)
15+
1416
### Changed
1517

18+
- [Core] Update `cucumber-core` dependency to 5.7.0 ([#42](https://github.com/cucumber/cucumber-jvm-scala/pull/42) LINK Gaël Jourdan-Weil)
19+
1620
### Deprecated
1721

22+
- [Scala] `Scenario.write(String)` & `Scenario.embed(byte[], String, String)` ([#42](https://github.com/cucumber/cucumber-jvm-scala/pull/42) LINK Gaël Jourdan-Weil)
23+
1824
### Removed
1925

2026
### Fixed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ The minor version might differ because Cucumber Scala may add Scala-related feat
1717

1818
| Cucumber Scala version | Cucumber version | Scala versions |
1919
|------------------------|------------------|------------------|
20+
| 5.7.0 | 5.7.0 | 2.11, 2.12, 2.13 |
2021
| 5.6.0 | 5.6.0 | 2.11, 2.12, 2.13 |
2122
| 4.7.1 | 4.7.1 | 2.11, 2.12, 2.13 |
2223

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>5.6.1-SNAPSHOT</version>
7+
<version>5.7.0-SNAPSHOT</version>
88
</parent>
99

1010
<artifactId>scala-examples</artifactId>

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
22
<modelVersion>4.0.0</modelVersion>
33
<artifactId>cucumber-jvm-scala</artifactId>
4-
<version>5.6.1-SNAPSHOT</version>
4+
<version>5.7.0-SNAPSHOT</version>
55
<packaging>pom</packaging>
66
<name>Cucumber-JVM: Scala</name>
77
<description>Cucumber for Scala</description>
@@ -20,7 +20,7 @@
2020
<minimum.maven.version>3.3</minimum.maven.version>
2121
<outputDirectory>${project.build.directory}</outputDirectory>
2222
<scala-maven-plugin.version>3.4.6</scala-maven-plugin.version>
23-
<cucumber.version>5.6.0</cucumber.version>
23+
<cucumber.version>5.7.0</cucumber.version>
2424
<gherkin.version>9.2.0</gherkin.version>
2525
<groovy.version>2.4.19</groovy.version>
2626
<jackson-databind.version>2.10.3</jackson-databind.version>

scala/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>5.6.1-SNAPSHOT</version>
7+
<version>5.7.0-SNAPSHOT</version>
88
</parent>
99

1010
<artifactId>cucumber-scala-aggregator</artifactId>

scala/scala_2.11/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-scala-aggregator</artifactId>
7-
<version>5.6.1-SNAPSHOT</version>
7+
<version>5.7.0-SNAPSHOT</version>
88
</parent>
99

1010
<artifactId>cucumber-scala_2.11</artifactId>

scala/scala_2.12/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-scala-aggregator</artifactId>
7-
<version>5.6.1-SNAPSHOT</version>
7+
<version>5.7.0-SNAPSHOT</version>
88
</parent>
99

1010
<artifactId>cucumber-scala_2.12</artifactId>

scala/scala_2.13/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-scala-aggregator</artifactId>
7-
<version>5.6.1-SNAPSHOT</version>
7+
<version>5.7.0-SNAPSHOT</version>
88
</parent>
99

1010
<artifactId>cucumber-scala_2.13</artifactId>

scala/sources/src/main/scala/io/cucumber/scala/Scenario.scala

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,101 @@ import java.util
55

66
import io.cucumber.core.backend.{Status, TestCaseState}
77

8+
/**
9+
* Before or After Hooks that declare a parameter of this type will receive an instance of this class.
10+
* It allows writing text and embedding media into reports, as well as inspecting results (in an After block).
11+
* <p>
12+
* Note: This class is not intended to be used to create reports. To create custom reports use
13+
* the `io.cucumber.plugin.Plugin` class. The plugin system provides a much richer access to Cucumbers then
14+
* hooks after could provide. For an example see `io.cucumber.core.plugin.PrettyFormatter`.
15+
*/
816
class Scenario(val delegate: TestCaseState) {
917

1018
def getSourceTagNames: util.Collection[String] = delegate.getSourceTagNames
1119

20+
/**
21+
* Returns the current status of this scenario.
22+
* <p>
23+
* The scenario status is calculate as the most severe status of the
24+
* executed steps in the scenario so far.
25+
*
26+
* @return the current status of this scenario
27+
*/
1228
def getStatus: Status = Status.valueOf(delegate.getStatus.name)
1329

30+
/**
31+
* @return true if and only if { @link #getStatus()} returns "failed"
32+
*/
1433
def isFailed: Boolean = delegate.isFailed
1534

16-
@deprecated
35+
@deprecated(message = "Use attach instead")
1736
def embed(data: Array[Byte], mediaType: String): Unit = {
1837
delegate.embed(data, mediaType)
1938
}
2039

40+
@deprecated(message = "Use attach instead", since = "5.7.0")
2141
def embed(data: Array[Byte], mediaType: String, name: String): Unit = {
22-
delegate.embed(data, mediaType, name)
42+
attach(data, mediaType, name)
2343
}
2444

45+
/**
46+
* Attach data to the report(s).
47+
* <pre>
48+
* {@code
49+
* // Attach a screenshot. See your UI automation tool's docs for
50+
* // details about how to take a screenshot.
51+
* scenario.attach(pngBytes, "image/png", "Bartholomew and the Bytes of the Oobleck");
52+
* }
53+
* </pre>
54+
* <p>
55+
* To ensure reporting tools can understand what the data is a
56+
* {@code mediaType} must be provided. For example: {@code text/plain},
57+
* {@code image/png}, {@code text/html;charset=utf-8}.
58+
* <p>
59+
* Media types are defined in <a href= https://tools.ietf.org/html/rfc7231#section-3.1.1.1>RFC 7231 Section 3.1.1.1</a>.
60+
*
61+
* @param data what to attach, for example an image.
62+
* @param mediaType what is the data?
63+
* @param name attachment name
64+
*/
65+
def attach(data: Array[Byte], mediaType: String, name: String): Unit = {
66+
delegate.attach(data, mediaType, name)
67+
}
68+
69+
@deprecated(message = "Use log instead", since = "5.7.0")
2570
def write(text: String): Unit = {
26-
delegate.write(text)
71+
log(text)
72+
}
73+
74+
/**
75+
* Outputs some text into the report.
76+
*
77+
* @param text what to put in the report.
78+
*/
79+
def log(text: String): Unit = {
80+
delegate.log(text)
2781
}
2882

83+
/**
84+
* @return the name of the Scenario
85+
*/
2986
def getName: String = delegate.getName
3087

88+
/**
89+
* @return the id of the Scenario.
90+
*/
3191
def getId: String = delegate.getId
3292

93+
/**
94+
* @return the uri of the Scenario.
95+
*/
3396
def getUri: URI = delegate.getUri
3497

98+
/**
99+
* @return the line in the feature file of the Scenario. If this is a Scenario
100+
* from Scenario Outlines this will return the line of the example row in
101+
* the Scenario Outline.
102+
*/
35103
def getLine: Integer = delegate.getLine
36104

37105
}

0 commit comments

Comments
 (0)