Skip to content
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

Allow for commenting of steps #50

Closed
janschaefer opened this issue Dec 20, 2014 · 2 comments
Closed

Allow for commenting of steps #50

janschaefer opened this issue Dec 20, 2014 · 2 comments

Comments

@janschaefer
Copy link
Contributor

It is already possible to provide an extended description to steps by using the @ExtendedDescription annotation. However, sometimes you want to comment a certain step-invocation and not all invocations of that step. This comment should also appear in the report.

Example:

given().something();
when().some_step()
  .and().some_surprising_step()
   .comment("a comment is especially important here because the step surprises the reader")
  then().something();
@janschaefer janschaefer added this to the v0.7.0 milestone Dec 23, 2014
@janschaefer janschaefer removed this from the v0.7.0 milestone Feb 10, 2015
@Airblader
Copy link
Contributor

Just to clarify, this should be really a new piece of information on a step rather than just setting the extendedDescription of a particular step instance?

@Airblader
Copy link
Contributor

Airblader commented Jun 25, 2016

Also, from my understanding of the codebase, this would roughly involve the following:

  • Add a new comment property to StepModel.java, similar to the extended description, and add it to the JSON protocol.
  • Introduce a new comment method in StageBase.java (or Stage.java to make it language-aware).
    • Introduce a new annotation for such a method, similar to @IntroWord.
    • Handle this annotation in ScenarioModelBuilder#stepMethodInvoked by setting the comment property of currentStep to the argument of the called method
    • TODO: can we somehow enforce that such a comment method must have exactly one argument of type String? That would be nicer then throwing a runtime wrong usage exception.
  • Handle the comment property in the HTML reporter (and possibly others?)
    • TODO: how should it be displayed?

I hope I got the basic design of this feature right.

Airblader added a commit to Airblader/JGiven that referenced this issue Jun 25, 2016
This commit allows commenting on a step by calling comment() after invoking
the corresponding step method. Furthermore, it displays said comment in
the plain text report, if one was given.

relates to TNG#50
Airblader added a commit to Airblader/JGiven that referenced this issue Jun 25, 2016
This commit allows commenting on a step by calling comment() after invoking
the corresponding step method. Furthermore, it displays said comment in
the plain text report, if one was given.

relates to TNG#50
Airblader added a commit to Airblader/JGiven that referenced this issue Jun 26, 2016
We display step comments just like extended descriptions as a tooltip.
In case both an extended description and a tooltip are specified for the
step, both are displayed with a line break in between them.

relates to TNG#50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants