Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 19 12:21

    aurelien-reeves on main

    Remove custom issue templates (… (compare)

  • May 19 12:21
    aurelien-reeves closed #230
  • May 18 15:42
    mattwynne opened #230
  • May 18 15:40

    mattwynne on use-shared-issue-templates

    Remove custom issue templates … (compare)

  • May 18 14:31
    aurelien-reeves commented #226
  • May 18 09:55
    aurelien-reeves opened #229
  • May 18 09:53

    github-actions[bot] on v11.0.0

    (compare)

  • May 18 09:50

    aurelien-reeves on v11.0.0

    Update release workflow accordi… (compare)

  • May 18 09:50

    aurelien-reeves on main

    Update release workflow accordi… (compare)

  • May 18 09:49

    aurelien-reeves on v11.0.0

    Update test workflow to not fai… Fix workflow Update ruby versions executed o… (compare)

  • May 18 09:48

    aurelien-reeves on main

    Update ruby versions executed o… (compare)

  • May 18 09:46

    aurelien-reeves on main

    Fix workflow (compare)

  • May 18 09:45

    aurelien-reeves on main

    Update test workflow to not fai… (compare)

  • May 18 09:40

    aurelien-reeves on v11.0.0

    (compare)

  • May 18 09:39

    aurelien-reeves on main

    Prepare release 11.0.0 (#228) … (compare)

  • May 18 09:39
    aurelien-reeves closed #228
  • May 18 09:36
    aurelien-reeves commented #228
  • May 18 09:35
    aurelien-reeves commented #228
  • May 18 09:35
    aurelien-reeves review_requested #228
  • May 18 09:34
    aurelien-reeves synchronize #228
Frank Bravo
@lefty1975

Longtime Cucumber user and Ruby enthusiast.
On a serious note, I'm struggling with when I should delete data and where I can (e.g. After hook)?

Scenario: As John I verify I feel good once I put on shoes
Given: I create a person named John
When:  I put my shoes on
Then: I feel refreshed
And: I delete person named John using an API call

In this scenario I am setting up my person named John from the UI, however, I don't want this person hanging around in my DB, so I'm adding a step to delete this individual. The scenario is not about deleting John, but feeling good about putting on shoes. So, if for some reason my deletion fails, then the test fails which is incorrect. So, can I abstract this step and place it into an After hook using a variable that I store John in? What if I have multiple scenarios creating multiple Johns, can I still abstract this step?

I know this might sound jumbled, so please tell me to provide further or clearer details.
Thanks.

Eric Kessler
@enkessler
@lefty1975 An After hook works well enough for this kind of thing.
Given(/^I create a person named John$/) do
  # Instance variable so that future steps can use this person
  @person_for_test = create_new_person('John')

  # Other steps may have already created people
  @people_created ||= []
  @people_created << @person_for_test
end
After do
  # Possible that no person creating steps were called/reached
  if @people_created
    @people_created.each do |person|
      delete_person(person)
    end
  end
end
Frank Bravo
@lefty1975
@enkessler sorry for the late response. Thank you for this solution.
sivaram
@SivaramMyid_twitter
Hi,
I am using scenario.failed? at after hook. But the control in not reaching out here. I am using raise to verify results at step_definitions? Please advice that I need to close and open the app when scenario failed.
Jonathan Kirst
@jskirst
Hey all, does anyone have experience working with cucumber-expressions? I wanted to try them out, and appear to have the gem installed, but none of my use cases are working. I suspect cucumber-expressions has not been fully implemented yet. Can anyone confirm or deny that?
I would expect the following to work, but its not -
Given "I am {string}" do |name|
Eric Kessler
@enkessler
I haven't upgrade yet, but I am under the impression that things are working.
https://cucumber.io/blog/2017/09/21/upgrading-to-cucumber-3
Jonathan Kirst
@jskirst
@enkessler Thanks for the link, definitely suggests so - I'll keep digging and report back here either way.
Frank Bravo
@lefty1975
I have been trying to solve this error message when executing my features in parallelization and cannot figure it out. I have searched high and low with no success. I do not have a rerun file either, so I'm at a lost. I can provide my ERB for verification, but I have used online tools to have it validated.
cucumber.yml was found, but could not be parsed with ERB.  Please refer to cucumber's documentation on correct profile usage.
#<Errno::EEXIST: File exists @ dir_s_mkdir - ./features/reports/2017-10-26__0925_32s>cucumber.yml was found, but could not be parsed with ERB.  Please refer to cucumber's documentation on correct profile usage.
#<Errno::EEXIST: File exists @ dir_s_mkdir - ./features/reports/2017-10-26__0925_32s>
Eric Kessler
@enkessler
Let's have a look at your cucumber.yml, shall we?
Frank Bravo
@lefty1975
<%
  @time = Time.now.strftime("%Y-%m-%d__%H%M_%Ss")
  Dir.mkdir('./features/reports/') unless File.exists?('./features/reports/')
  @report_path = "./features/reports/#{@time}/"
  @screenshot_path = "./features/reports/#{@time}/"
  @new_dir_setup = -> { Dir.mkdir(@report_path) unless File.exists?(@report_path) }
  ENV['SERVER_URL'] = ENV['SERVER_URL']
%>

# Cucumber Base Profile components:
common: RESET_BETWEEN_SCENARIOS=1 SERVER_URL=<%= ENV['SERVER_URL']%> -f progress -r features
html_report: <%@new_dir_setup.call%> -f html --out=<%= @report_path%>web_test_report<%= ENV['TEST_ENV_NUMBER']%>.html SCREENSHOT_PATH=<%= @screenshot_path%>
Eric Kessler
@enkessler
Have you played the fun game of 'does it parse if I remove this bit' yet?
Also, ENV['SERVER_URL'] = ENV['SERVER_URL'] isn't going to do much for you.
Frank Bravo
@lefty1975
no, but I am willing to give anything a try at this point.
except for Coconut milk, I can't stand coconut.
Eric Kessler
@enkessler
Why do you call <%@new_dir_setup.call%> in the html_report profile instead of up with the rest of the setup code?
I think that gets evaluated when the file is read in, not just when the html_report profile is used.
Frank Bravo
@lefty1975
Truth be told, I borrowed/copied this ERB code from a former colleague and never really thought twice about it. So, let me play around with that as well. The more I look like at that line, it seem unwarranted.
Anna Baik
@TesterAB_twitter
This is probably an obvious question: but are there actually any changes between the Ruby cucumber 2.4.0 gem and the 2.99.0 gem?
Anna Baik
@TesterAB_twitter
I'm basically looking at first steps to upgrade to 3.0.0 and wondering whether there's any point in going through 2.99.0
Eric Kessler
@enkessler

@TesterAB_twitter Because Cucumber is Semantically Versioned, there should not be any changes from 2.4 to 2.99 that would be a problem for you (i.e. breaking changes). You will quite possibly encounter them at 3.0 but if you plan on upgrading to that point anyway, then you might as well go straight there and deal with whatever comes up.

Here is a handy blog post about upgrading to Cucumber 3.0 https://cucumber.io/blog/2017/09/21/upgrading-to-cucumber-3

Frank Bravo
@lefty1975
@TesterAB_twitter I have encountered an issue upgrading to Cucumber 3.0 grosser/parallel_tests#586 when using the parallel_tests gem. Just an FYI if you're using this gem.
Eric Kessler
@enkessler
I use that where I work but we have not upgraded to Cucumber 3.x yet. At a glance, parallel_tests does not declare any particular gem dependencies, so there is nothing protecting it from upgrades.
Björn Rasmusson
@brasmusson
@enkessler The parallel_tests gem includes a formatter which instantiate/use internal Cucumber-Ruby formatters which have been rewritten to the new formatter API, so that parallel_tests formatter does not work with Cucumber-Ruby 3.x, see cucumber/cucumber#294
@TesterAB_twitter The only difference in 2.99.0 is that it issues a deprecation warning for Transforms, which are removed in v3.0.0, see cucumber/cucumber-ruby#1190
Anna Baik
@TesterAB_twitter
thanks all - that was helpful. We do need to change one place that we use Transform from the look of it - but we can upgrade to 2.99.0 and then it'll let us know if there's anywhere we missed before we go to 3.
greener
@greenr_twitter
Hi, I'm using cucumber-ruby 3.0 and want to generate json reports for consolidated multiple reports via the command below, but no luck. I always get empty report file. can anyone advise me how to generate json reports? thanks!
cucumber --tags @allfeatures -f json -o reports/results.json
Eric Kessler
@enkessler
Do you get no results with other formatters? Try using the pretty or html formatter as well and see if they agree with the json formatter.
greener
@greenr_twitter
Alright. I've get results. I found that I added exit tests if any errors in After hooks and I can't get any reports if any test failures.
Thanks for suggestions!
BhupenderAgarwal24
@BhupenderAgarwal24
Hi, can I pass a variable to scenario which should be pass to each step under that scenario?
Eric Kessler
@enkessler
What is your use case/context?
BhupenderAgarwal24
@BhupenderAgarwal24
I have a variable which gets used for each step and instead of passing along which each step I want to pass it to scenario which should pass it to all steps underneath it
Eric Kessler
@enkessler

So you've got something like

Scenario:
  * this step needs a "7"
  * this step also needs that "7"
  * don't forget the "7"

And you want something like

Scenario: Everyone loves "7"
  * I love that number
  * so do I
  * me too
Yes?
BhupenderAgarwal24
@BhupenderAgarwal24
yes
so as per your example, if I pass that parameter along with scenario, does it get pass on to all steps?
Eric Kessler
@enkessler
Nah. Things don't work like that.
You can do this, however.:
Scenario:
  Given we are working with the number "7"
  Then we can do stuff with it
  And even more stuff
Given /^we are working with the number "(\d+)"$/ do |number|
  @current_number = number
end

Then /^we can do stuff with it$/ do
  puts "Doing stuff with #{@current_number}"
end

Then /^even more stuff$/ do
  puts "Doing more stuff with #{@current_number}"
end
Cezar Cruz
@cezarcruz
Hello guys, i'm very new in cucumber and I have this doubt: How I deal with my client database? in some scenarios i need to get some id from database (executing a sql) and i not sure about the good way to do. There is some good pratice to deal with?
BhupenderAgarwal24
@BhupenderAgarwal24
Thank you @enkessler for the example. This perfectly would solve my problem.
Eric Kessler
@enkessler
@BhupenderAgarwal24 You're welcome.
BhupenderAgarwal24
@BhupenderAgarwal24
Hi, can we use same pattern for different statements while still maintaining the same definition?
For example, is it possible to have something like below:
Scenario: When I call my friend
Given He got his phone with him
When He's not in office
Then He'll attend my call
Given I call my father
And He's not in office
But Still couldn't attend my call
As you can see above I have When, And with same statement. Is it possible to have same definition for both statement instead of re-writing it
Eric Kessler
@enkessler
Yes, it is. Step definitions are matched to Gherkin statements using regular expressions. An example of a step definition that would match both When I call my friend and Given I call my father is
When /^I call my (friend|father)$/ do |person|
  call_person(person)
end
The keyword does not matter when matching step definitions. Given/When/And/etc. are ignored and only the freeform part of the statement is considered.
BhupenderAgarwal24
@BhupenderAgarwal24
thanks for the resolution :smile:
Eric Kessler
@enkessler
You're welcome.
Ryan
@rstellar
Hello!