Skip to content

Implement HookDefinition.getHookType and unimplement Location.getLocationΒ #401

@mpkorstanje

Description

@mpkorstanje

πŸ€” What's the problem you're trying to solve?

I'm re-implementing the json-formatter to use messages. And as part of that I'm running regression tests with cucumber-jvm 7.26.0 and cucumber-scala 8.29.0.

Currently HookDefinition.getHookType is not implemented. As a result it is not possible to produce report.json from an equivalent message stream in report.ndjson.

Additionally this Location.getLocation implementation is giving me some problems:

// Easier to just print out fileName and lineNumber
override def getLocation(): String =
stepDetails.frame.getFileName + ":" + stepDetails.frame.getLineNumber

The message protocol includes the source reference rather than the location string. And because the source reference in this case is based off a stacktrace element, I can't reproduce the location string as Cucumber Scala produces it, because the Cucumber Java8 backend uses StackTraceElement.toString() and I can't tell from the messages which backend is used.

Removing the implementation would help me out as the expected implementation is already used here:

override def getLocation(): String = {
location.toString
}

✨ What's your proposed solution?

n/a

⛏ Have you considered any alternatives or workarounds?

For the regression tests I can probably grep around the results of Location.getLocation. But I can't do without HookDefinition.getHookType.

πŸ“š Any additional context?

Regression tests for Scala are added here cucumber/cucumber-json-formatter#2

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions