Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 18 20:19
    botandrose synchronize #247
  • Jan 18 20:11
    botandrose synchronize #247
  • Jan 18 16:16
    botandrose opened #247
  • Jan 11 09:26
    aslakhellesoy commented #559
  • Jan 11 09:26

    luke-hill on main

    Remove `mime-types`, `rexml`, a… (compare)

  • Jan 11 09:26
    luke-hill closed #559
  • Jan 10 20:38
    orien synchronize #559
  • Jan 10 20:30
    orien synchronize #559
  • Jan 10 20:24
    orien synchronize #559
  • Jan 10 11:41

    luke-hill on remove-gh-templates

    (compare)

  • Jan 10 11:41

    luke-hill on main

    Remove PR/issue templates (#555… (compare)

  • Jan 10 11:41
    luke-hill closed #555
  • Jan 10 11:29
    luke-hill auto_merge_enabled #555
  • Jan 10 11:29
    luke-hill commented #555
  • Jan 10 11:29
    luke-hill synchronize #555
  • Jan 10 11:29

    luke-hill on remove-gh-templates

    chore(deps): update actions/che… Merge branch 'main' into remove… (compare)

  • Jan 08 16:58

    mpkorstanje on main

    chore(deps): update actions/che… (compare)

  • Jan 08 16:58

    mpkorstanje on actions-checkout-3.x

    (compare)

  • Jan 08 16:58
    mpkorstanje closed #557
  • Jan 07 09:09
    orien edited #559
Eric Kessler
@enkessler
@luke-hill There is a 'description' section between the name of the outline and the steps, yes. This should be the same for Feature:, Scenario:, Scenario Outline:, and Examples:. There may be a bug in the formatter.
Also Background:
greybox99
@greybox99
Hi
does 'Then the output should contain' not support multi-line?
how do I test for multiple words in output?
Eric Kessler
@enkessler
@greybox99 We'll need a little more context than that. Is that a step that you made or what?
greybox99
@greybox99
@enkessler thanks for getting back to me
@enkessler it's the default cucumber step def
Then the output should contain:
"""
word
"""
however my output contains multiple words that I need to test for, not in same order.
how to do this?
Eric Kessler
@enkessler
How are you capturing the output?
greybox99
@greybox99
@enkessler it's a bash command with Aruba
@enkessler doesn't cucumber have any built in func to test output for multiple words?
Eric Kessler
@enkessler
Not to my knowledge, no.
greybox99
@greybox99
@enkessler what would be the best way to do this then?
Take your pick.
greybox99
@greybox99
@enkessler I already have the output...
@enkessler as I said I need to test for multiple words in the output
Eric Kessler
@enkessler
If you can already test for a single word/phrase, you could simply loop through all of your expected words/phrases and check them individually.
greybox99
@greybox99
thats a lot of duplicate tests rather than writing multiple words in the same test....
Eric Kessler
@enkessler
How is that duplicated?
greybox99
@greybox99

When I run w
Then the output should contain:
"""
uptime
"""

When I run w
Then the output should contain:
"""
days
"""

how is this not duplication?
Eric Kessler
@enkessler
That's not a Ruby loop. That's copy pasting Gherkin over and over, which was not my suggestion.
greybox99
@greybox99
instead of just
"""
uptime
days
"""
Eric Kessler
@enkessler
When you get the multi-line block in your step def, #split it on newlines and loop through the resulting array.
greybox99
@greybox99
@enkessler can you show me?
Eric Kessler
@enkessler
Then(/your pattern here/) do |expected_words|
  expected_words.split("\n").each do |word|
    expect(@previously_captured_output).to include(word)
  end
end
Something like that.
greybox99
@greybox99

@enkessler
expected nil to include "days", but it does not respond to include? (RSpec::Expectations::ExpectationNotMetError)
./features/step_definitions/lines_steps.rb:3:in block (2 levels) in <top (required)>' ./features/step_definitions/lines_steps.rb:2:ineach'
./features/step_definitions/lines_steps.rb:2:in `/^the output should include:$/'

on

Then(/^the output should include:$/) do |expected_words|
expected_words.split("\n").each do |word|
expect(@previously_captured_output).to include(word)
end
end

Eric Kessler
@enkessler
So...did you save the captured output into @previously_captured_output?
greybox99
@greybox99
yeah defined @previously_captured_output before the test
Eric Kessler
@enkessler
And yet it is nil.
greybox99
@greybox99
test is
@previously_captured_output
Scenario: Verify w
When I successfully run w
Then the output should include:
"""
days
"""
Eric Kessler
@enkessler
You applied @previously_captured_output as a tag on the test?
greybox99
@greybox99
is that not the way to save it?
Eric Kessler
@enkessler
That is not the way to save it.
A Gherkin tag and a Ruby Instance variable have nothing to do with each other.
greybox99
@greybox99
why do the step def need to search for the output within that tag? should be captured under all
Eric Kessler
@enkessler
@previously_captured_output is not a tag. It is an instance variable.
Rather, in Gherkin it is a tag but in Ruby it is an instance variable.
You are working with two languages.
greybox99
@greybox99
my apologies, so how do I set this?
Eric Kessler
@enkessler
What does your When step definition look like?
greybox99
@greybox99
@enkessler it's a built in method from Aruba which allows you to run bash commands directly from Gherkin
@enkessler is there any way I can avoid specifying @previously_captured_output and just search in all?
Eric Kessler
@enkessler
I don't know. I am not familiar with Aruba.
But they appear to have a room as well: https://gitter.im/cucumber/aruba