luke-hill on bundler
luke-hill on main
Development updates (#552) - U… (compare)
Then the output should include: # features/step_definitions/lines_steps.rb:1
"""
days
uptime
"""
expected #<Aruba::Command(#<Aruba::Processes::SpawnProcess:9551740 commandline="w": output=" 17:00:53 up 15 days, 3:17, 1 user, load average: 0.01, 0.02, 0.05
USER ...">)> to include "days", but it does not respond to `include?`
Diff:
@@ -1,2 +1,3 @@
-["days"]
+#<Aruba::Processes::SpawnProcess:9551740 commandline="w": output=" 17:00:53 up 15 days, 3:17, 1 user, load average: 0.01, 0.02, 0.05
+USER ...">
(RSpec::Expectations::ExpectationNotMetError)
./features/step_definitions/lines_steps.rb:3:in `block (2 levels) in <top (required)>'
./features/step_definitions/lines_steps.rb:2:in `each'
./features/step_definitions/lines_steps.rb:2:in `/^the output should include:$/'
Then(/^(?:the )?(output|stdout|stderr) should( not)? contain all of these lines:$/)
Ambiguous match of "the output should contain all of these lines:":
aruba-0.14.2/lib/aruba/cucumber/command.rb:356:in /^(?:the )?(output|stdout|stderr) should( not)? contain all of these lines:$/'
features/step_definitions/lines_steps.rb:1:in
/^(?:the )?(output|stdout|stderr) should( not)? contain all of these lines:$/'
Then the output should contain all of these lines: # aruba-0.14.2/lib/aruba/cucumber/command.rb:356
| uptime |
| days |
expected [#<Aruba::Command(#<Aruba::Processes::SpawnProcess:9483560 commandline="w": output=" 17:05:29 up 15 days, 3:21, 1 user, load average: 0.00, 0.01, 0.05
USER ...">)>] to include an object have output: string includes: "uptime"
object at index 0 failed to match:
expected " 17:05:29 up 15 days, 3:21, 1 user, load average: 0.00, 0.01, 0.05\nUSER TTY FROM ...PU PCPU WHAT\ncentos pts/0 10.2.153.10 11:51 1.00s 1.35s 0.18s sshd: centos [priv]" to have output: string includes: "uptime" (RSpec::Expectations::ExpectationNotMetError)
features/landingzone_baseline.feature:35:in `Then the output should contain all of these lines:'
maxInstances
property
capabilities.browserName
, it'll launch 3 firefox sessions and 3 chrome sessions
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.
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
Given "I am {string}" do |name|
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>
<%
@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%>
ENV['SERVER_URL'] = ENV['SERVER_URL']
isn't going to do much for you.
html_report
profile is used.