-
-
Notifications
You must be signed in to change notification settings - Fork 161
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
Fix cucumber coverage #898
base: main
Are you sure you want to change the base?
Changes from 6 commits
d44a464
b9f98f8
7c71251
f8ed82e
edd5992
f196a14
0cbb23b
fb37cfe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,7 +55,7 @@ Feature: Usage of configuration | |
Given a file named "spec/support/aruba_config.rb" with: | ||
"""ruby | ||
Aruba.configure do |config| | ||
config.exit_timeout = 0.5 | ||
config.exit_timeout = 0.7 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd rather avoid these changes to the timeouts. Aruba's tests suite takes a long time as it is. Also, I ran the full test suite without these timeout changes and there were no failures. Are you able to run the test suite without failures from the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I remember correctly, I increased the timeouts so that the tests would pass the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's also worth noting, that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm .. maybe |
||
end | ||
""" | ||
And a file named "spec/support/hooks.rb" with: | ||
|
@@ -96,7 +96,7 @@ Feature: Usage of configuration | |
Given a file named "features/support/aruba_config.rb" with: | ||
"""ruby | ||
Aruba.configure do |config| | ||
config.exit_timeout = 0.5 | ||
config.exit_timeout = 0.7 | ||
end | ||
""" | ||
And a file named "features/run.feature" with: | ||
|
@@ -107,7 +107,7 @@ Feature: Usage of configuration | |
Then the exit status should be 0 | ||
|
||
Scenario: Slow command | ||
When I run `aruba-test-cli 1.0` | ||
When I run `aruba-test-cli 1.5` | ||
Then the exit status should be 128 | ||
""" | ||
When I run `cucumber` | ||
|
@@ -122,7 +122,7 @@ Feature: Usage of configuration | |
Given a file named "features/support/aruba_config.rb" with: | ||
"""ruby | ||
Aruba.configure do |config| | ||
config.exit_timeout = 0.2 | ||
config.exit_timeout = 0.7 | ||
end | ||
""" | ||
And a file named "features/support/hooks.rb" with: | ||
|
@@ -140,11 +140,11 @@ Feature: Usage of configuration | |
|
||
@slow-command | ||
Scenario: Slow command known by the developer | ||
When I run `aruba-test-cli 0.5` | ||
When I run `aruba-test-cli 1` | ||
Then the exit status should be 0 | ||
|
||
Scenario: Slow command which might be a failure | ||
When I run `aruba-test-cli 0.5` | ||
When I run `aruba-test-cli 1` | ||
Then the exit status should be 128 | ||
""" | ||
When I run `cucumber` | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ Feature: Use fixtures in your tests | |
Given I use a fixture named "cli-app" | ||
|
||
Scenario: Use a fixture for your tests | ||
Given a file named "spec/fixture_spec.rb" with: | ||
Given a file named "spec/fixture_a_spec.rb" with: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When you remove the changes to the timeouts (see my comment above) please keep the changes in this file. |
||
""" | ||
require 'spec_helper' | ||
|
||
|
@@ -30,7 +30,7 @@ Feature: Use fixtures in your tests | |
Then the specs should all pass | ||
|
||
Scenario: Pass file from fixtures to your command | ||
Given a file named "spec/fixture_spec.rb" with: | ||
Given a file named "spec/fixture_b_spec.rb" with: | ||
""" | ||
require 'spec_helper' | ||
|
||
|
@@ -56,7 +56,7 @@ Feature: Use fixtures in your tests | |
Then the specs should all pass | ||
|
||
Scenario: Use a fixture for your tests in test/ | ||
Given a file named "spec/fixture_spec.rb" with: | ||
Given a file named "spec/fixture_c_spec.rb" with: | ||
""" | ||
require 'spec_helper' | ||
|
||
|
@@ -76,7 +76,7 @@ Feature: Use fixtures in your tests | |
Then the specs should all pass | ||
|
||
Scenario: Use a fixture for your tests in spec/ | ||
Given a file named "spec/fixture_spec.rb" with: | ||
Given a file named "spec/fixture_d_spec.rb" with: | ||
""" | ||
require 'spec_helper' | ||
|
||
|
@@ -96,7 +96,7 @@ Feature: Use fixtures in your tests | |
Then the specs should all pass | ||
|
||
Scenario: Use a fixture for your tests in features/ | ||
Given a file named "spec/fixture_spec.rb" with: | ||
Given a file named "spec/fixture_e_spec.rb" with: | ||
""" | ||
require 'spec_helper' | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,32 @@ | ||
$LOAD_PATH.unshift File.expand_path("../../lib", __dir__) | ||
|
||
# Has to be the first file required so that all other files show coverage information | ||
require "simplecov" unless RUBY_PLATFORM.include?("java") | ||
require_relative "simplecov/simplecov_setup" unless RUBY_PLATFORM.include?("java") | ||
|
||
# Standard Library | ||
require "fileutils" | ||
require "pathname" | ||
|
||
# Gems | ||
require "aruba/cucumber" | ||
require "aruba/config/jruby" | ||
require "rspec/expectations" | ||
|
||
Before do |test_case| | ||
Around do |test_case, block| | ||
command_name = "#{test_case.location.file}:#{test_case.location.line} # #{test_case.name}" | ||
|
||
# Used in simplecov_setup so that each scenario has a different name and | ||
# their coverage results are merged instead of overwriting each other as | ||
# 'Cucumber Features' | ||
ENV["SIMPLECOV_COMMAND_NAME"] = command_name.to_s | ||
set_environment_variable 'SIMPLECOV_COMMAND_NAME', command_name.to_s | ||
|
||
simplecov_setup_pathname = | ||
Pathname.new(__FILE__).expand_path.parent.join("simplecov_setup") | ||
Pathname.new(__FILE__).expand_path.parent.join('simplecov').to_s | ||
|
||
# set environment variable so child processes will merge their coverage data | ||
# with parent process's coverage data. | ||
ENV["RUBYOPT"] = "-r#{simplecov_setup_pathname} #{ENV['RUBYOPT']}" | ||
prepend_environment_variable 'RUBYOPT', "-I#{simplecov_setup_pathname} -rsimplecov_setup " | ||
|
||
with_environment do | ||
block.call | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# @note this file is loaded in env.rb to setup simplecov using RUBYOPTs for | ||
# child processes and @in-process | ||
unless RUBY_PLATFORM.include?("java") | ||
require "simplecov" | ||
root = File.expand_path("../../..", __dir__) | ||
command_name = ENV["SIMPLECOV_COMMAND_NAME"] || "Cucumber Features" | ||
SimpleCov.command_name(command_name) | ||
SimpleCov.root(root) | ||
|
||
# Run simplecov by default | ||
SimpleCov.start unless ENV.key? "ARUBA_NO_COVERAGE" | ||
|
||
module SimpleCov | ||
module Formatter | ||
class HTMLFormatter | ||
def format(result) | ||
Dir[File.join(File.dirname(__FILE__), "../public/*")].each do |path| | ||
FileUtils.cp_r(path, asset_output_path) | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't work because the original code refers to a One way to fix this would be to However another option would be to set There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch! I'll give the |
||
|
||
File.open(File.join(output_path, "index.html"), "wb") do |file| | ||
file.puts template("layout").result(binding) | ||
end | ||
File.open(File.join(output_path, "summary.txt"), "w") do |file| | ||
file.puts output_message(result) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't normally be needed. Can you remove this commit please?