Skip to content

Upgrade to Cucumber 5.7.0 #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@ See also the [CHANGELOG](https://github.com/cucumber/cucumber-jvm/blob/master/CH

### Added

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

### Changed

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

### Deprecated

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

### Removed

### Fixed
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The minor version might differ because Cucumber Scala may add Scala-related feat

| Cucumber Scala version | Cucumber version | Scala versions |
|------------------------|------------------|------------------|
| 5.7.0 | 5.7.0 | 2.11, 2.12, 2.13 |
| 5.6.0 | 5.6.0 | 2.11, 2.12, 2.13 |
| 4.7.1 | 4.7.1 | 2.11, 2.12, 2.13 |

Expand Down
2 changes: 1 addition & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-jvm-scala</artifactId>
<version>5.6.1-SNAPSHOT</version>
<version>5.7.0-SNAPSHOT</version>
</parent>

<artifactId>scala-examples</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<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">
<modelVersion>4.0.0</modelVersion>
<artifactId>cucumber-jvm-scala</artifactId>
<version>5.6.1-SNAPSHOT</version>
<version>5.7.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Cucumber-JVM: Scala</name>
<description>Cucumber for Scala</description>
Expand All @@ -20,7 +20,7 @@
<minimum.maven.version>3.3</minimum.maven.version>
<outputDirectory>${project.build.directory}</outputDirectory>
<scala-maven-plugin.version>3.4.6</scala-maven-plugin.version>
<cucumber.version>5.6.0</cucumber.version>
<cucumber.version>5.7.0</cucumber.version>
<gherkin.version>9.2.0</gherkin.version>
<groovy.version>2.4.19</groovy.version>
<jackson-databind.version>2.10.3</jackson-databind.version>
Expand Down
2 changes: 1 addition & 1 deletion scala/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-jvm-scala</artifactId>
<version>5.6.1-SNAPSHOT</version>
<version>5.7.0-SNAPSHOT</version>
</parent>

<artifactId>cucumber-scala-aggregator</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion scala/scala_2.11/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-scala-aggregator</artifactId>
<version>5.6.1-SNAPSHOT</version>
<version>5.7.0-SNAPSHOT</version>
</parent>

<artifactId>cucumber-scala_2.11</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion scala/scala_2.12/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-scala-aggregator</artifactId>
<version>5.6.1-SNAPSHOT</version>
<version>5.7.0-SNAPSHOT</version>
</parent>

<artifactId>cucumber-scala_2.12</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion scala/scala_2.13/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-scala-aggregator</artifactId>
<version>5.6.1-SNAPSHOT</version>
<version>5.7.0-SNAPSHOT</version>
</parent>

<artifactId>cucumber-scala_2.13</artifactId>
Expand Down
74 changes: 71 additions & 3 deletions scala/sources/src/main/scala/io/cucumber/scala/Scenario.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,101 @@ import java.util

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

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

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

/**
* Returns the current status of this scenario.
* <p>
* The scenario status is calculate as the most severe status of the
* executed steps in the scenario so far.
*
* @return the current status of this scenario
*/
def getStatus: Status = Status.valueOf(delegate.getStatus.name)

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

@deprecated
@deprecated(message = "Use attach instead")
def embed(data: Array[Byte], mediaType: String): Unit = {
delegate.embed(data, mediaType)
}

@deprecated(message = "Use attach instead", since = "5.7.0")
def embed(data: Array[Byte], mediaType: String, name: String): Unit = {
delegate.embed(data, mediaType, name)
attach(data, mediaType, name)
}

/**
* Attach data to the report(s).
* <pre>
* {@code
* // Attach a screenshot. See your UI automation tool's docs for
* // details about how to take a screenshot.
* scenario.attach(pngBytes, "image/png", "Bartholomew and the Bytes of the Oobleck");
* }
* </pre>
* <p>
* To ensure reporting tools can understand what the data is a
* {@code mediaType} must be provided. For example: {@code text/plain},
* {@code image/png}, {@code text/html;charset=utf-8}.
* <p>
* 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>.
*
* @param data what to attach, for example an image.
* @param mediaType what is the data?
* @param name attachment name
*/
def attach(data: Array[Byte], mediaType: String, name: String): Unit = {
delegate.attach(data, mediaType, name)
}

@deprecated(message = "Use log instead", since = "5.7.0")
def write(text: String): Unit = {
delegate.write(text)
log(text)
}

/**
* Outputs some text into the report.
*
* @param text what to put in the report.
*/
def log(text: String): Unit = {
delegate.log(text)
}

/**
* @return the name of the Scenario
*/
def getName: String = delegate.getName

/**
* @return the id of the Scenario.
*/
def getId: String = delegate.getId

/**
* @return the uri of the Scenario.
*/
def getUri: URI = delegate.getUri

/**
* @return the line in the feature file of the Scenario. If this is a Scenario
* from Scenario Outlines this will return the line of the example row in
* the Scenario Outline.
*/
def getLine: Integer = delegate.getLine

}