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

Do not require intro words #74

Closed
janschaefer opened this issue May 21, 2015 · 2 comments
Closed

Do not require intro words #74

janschaefer opened this issue May 21, 2015 · 2 comments

Comments

@janschaefer
Copy link
Contributor

Currently JGiven requires to have intro words like and(), with(), but(), between step method calls e.g.:

given().flour()
  .and().eggs()
  .and().water();

If this is not given, the generated report looks somewhat strange. In addition, the intro words are sometimes not really needed/wanted. Instead one should be able to write:

given().flour()
  .eggs()
  .and().water();

The open question is now, how the report should look like. There are some possibilities:

  1. Just left out the entry word:
Given flour
      eggs
  and water
  1. Add a comma instead an intro word, but put the step on its own line
Given flour
    , eggs
  and water
  1. Add a comma at the end of the previous step, but put the step on its own line
Given flour,
      eggs
  and water
  1. Add a comma, but put the steps on one line:
Given flour, eggs
  and water
@nobeh
Copy link

nobeh commented May 21, 2015

From a user perspective, I actually like the way it is now in the report. The reason is simple; from a logic and formal method perspective, it's concise and the formatting is also clear.

Now, on a related topic, I suppose the reason there is no or() in JGiven is basically because of the next challenge which is logical group(). Is this correct or it's on the roadmap?

@janschaefer
Copy link
Contributor Author

Thanks for your opinion! However, in my opinion the current formatting in the report is not very nice. The above example would be printed as:

  Given flour
  eggs
    and water

so eggs is aligned with Given.

To your second point: there is no or() in the Stage class, however, you can add arbitrary introduction methods to your stage classes if you want them. Just add a method like that:

@IntroWord
public SELF or() {
   return self();
}

Regarding your 3rd point: there is a plan to be able to group steps. It is tracked by Issue #17, which I called Meta Steps.

@janschaefer janschaefer added this to the v0.7.3 milestone Jun 16, 2015
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