Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blo

## [Unreleased]
### Added
- Add timestamp to `Attachment` message
- A first initial iteration of the new `cucumber-query` structure ([#1801](https://github.com/cucumber/cucumber-ruby/pull/1801) [luke-hill](https://github.com/luke-hill))

> This is currently not consumed anywhere, but will become the building blocks for the future of cucumber formatters
Expand Down
35 changes: 29 additions & 6 deletions compatibility/cck_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# frozen_string_literal: true

require_relative 'support/shared_examples'
require_relative 'support/cck/examples'
require_relative 'support/compatibility_kit'

require 'cck/examples'
require 'cucumber/compatibility_kit'

# This is the implementation of the CCK testing for cucumber-ruby
# It will run each example from the CCK that is of type "gherkin" (As "markdown" examples aren't implemented in ruby)
Expand All @@ -13,13 +13,36 @@
describe CCK, :cck do
let(:cucumber_command) { 'bundle exec cucumber --publish-quiet --profile none --format message' }

CCK::Examples.gherkin.each do |example_name|
# CCK v22 conformance status update - Jan 2026
# OVERALL: 93 examples, 15 failures, 78 passed
# SANITIZED: 69 examples, 0 failures, 69 passed

items_to_fix =
%w[
ambiguous
backgrounds
global-hooks
global-hooks-afterall-error
global-hooks-attachments
global-hooks-beforeall-error
multiple-features-reversed
retry
]
_failing, passing = CompatibilityKit.gherkin.partition { |name| items_to_fix.include?(name) }

passing.each do |example_name|
describe "'#{example_name}' example" do
include_examples 'cucumber compatibility kit' do
let(:example) { example_name }
let(:extra_args) { example == 'retry' ? '--retry 2' : '' }
let(:support_code_path) { CCK::Examples.supporting_code_for(example) }
let(:messages) { `#{cucumber_command} #{extra_args} --require #{support_code_path} #{cck_path}` }
let(:extra_args) do
if File.exist?("#{cck_path}/#{example}.arguments.txt")
File.read("#{cck_path}/#{example}.arguments.txt").to_s
else
''
end
end
let(:support_code_path) { CompatibilityKit.supporting_code_for(example) }
let(:messages) { `#{cucumber_command} --require #{support_code_path} #{cck_path} #{extra_args}` }
end
end
end
Expand Down
9 changes: 9 additions & 0 deletions compatibility/features/ambiguous/ambiguous_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

Given(/^a (.*?) with (.*?)$/) do |_arg1, _arg2|
# no-op
end

Given(/^a step with (.*)$/) do |_arg1|
# no-op
end
5 changes: 5 additions & 0 deletions compatibility/features/doc-strings/doc-strings_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

Given('a doc string:') do |doc_string|
# no-op
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# frozen_string_literal: true

BeforeAll do
# no-op
end

BeforeAll do
raise 'BeforeAll hook went wrong'
end

BeforeAll do
# no-op
end

When('a step passes') do
# no-op
end

AfterAll do
# no-op
end

AfterAll do
# no-op
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

BeforeAll do
attach('Attachment from BeforeAll hook', 'text/plain')
end

When('a step passes') do
# no-op
end

AfterAll do
attach('Attachment from AfterAll hook', 'text/plain')
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# frozen_string_literal: true

BeforeAll do
# no-op
end

BeforeAll do
# no-op
end

When('a step passes') do
# no-op
end

AfterAll do
# no-op
end

AfterAll do
raise 'AfterAll hook went wrong'
end

AfterAll do
# no-op
end
25 changes: 25 additions & 0 deletions compatibility/features/global-hooks/global-hooks_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# frozen_string_literal: true

BeforeAll do
# no-op
end

BeforeAll do
# no-op
end

When('a step passes') do
# no-op
end

When('a step fails') do
raise 'Exception in step'
end

AfterAll do
# no-op
end

AfterAll do
# no-op
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

Given('an order for {string}') do |_item|
# no-op
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

Given('an order for {string}') do |_item|
# no-op
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

Given(/^a (.*?)(?: and a (.*?))?(?: and a (.*?))?$/) do |_vegetable1, _vegetable2, _vegetable3|
# no-op
end
12 changes: 12 additions & 0 deletions compatibility/features/retry/retry_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,15 @@
Given('a step that always fails') do
raise 'Exception in step'
end

Given('an ambiguous step') do
# first one
end

Given('an ambiguous step') do
# second one
end

Given('a pending step') do
pending('')
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

Given('an order for {string}') do |_item|
# no-op
end

When('an action') do
# no-op
end

Then('an outcome') do
# no-op
end
9 changes: 9 additions & 0 deletions compatibility/features/unused-steps/unused-steps_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

Given('a step that is used') do
# no-op
end

Given('a step that is not used') do
# no-op
end
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# frozen_string_literal: true

require_relative '../../support/cck/examples'
require_relative '../support/compatibility_kit'

describe CCK::Examples do
let(:features_path) { File.expand_path("#{File.dirname(__FILE__)}/../../features") }
describe CompatibilityKit do
let(:features_path) { File.expand_path("#{File.dirname(__FILE__)}/../features") }

describe '#supporting_code_for' do
describe '.supporting_code_for' do
context 'with an example that exists' do
it 'returns the path of the folder containing the supporting code for the example' do
expect(described_class.supporting_code_for('hooks')).to eq("#{features_path}/hooks")
Expand Down
21 changes: 0 additions & 21 deletions compatibility/support/cck/examples.rb

This file was deleted.

19 changes: 19 additions & 0 deletions compatibility/support/compatibility_kit.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

class CompatibilityKit
class << self
def supporting_code_for(example_name)
path = File.join(local_features_folder_location, example_name)

return path if File.directory?(path)

raise ArgumentError, "No supporting code directory found locally for CCK example: #{example_name}"
end

private

def local_features_folder_location
File.expand_path("#{File.dirname(__FILE__)}/../features/")
end
end
end
2 changes: 1 addition & 1 deletion compatibility/support/shared_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
RSpec.shared_examples 'cucumber compatibility kit' do
include CCK::Helpers

let(:cck_path) { CCK::Examples.feature_code_for(example) }
let(:cck_path) { CompatibilityKit.feature_code_for(example) }

let(:parsed_original) { parse_ndjson_file("#{cck_path}/#{example}.ndjson") }
let(:parsed_generated) { parse_ndjson(messages) }
Expand Down
2 changes: 1 addition & 1 deletion cucumber.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Gem::Specification.new do |s|
s.add_dependency 'multi_test', '~> 1.1'
s.add_dependency 'sys-uname', '~> 1.3'

s.add_development_dependency 'cucumber-compatibility-kit', '~> 20.0'
s.add_development_dependency 'cucumber-compatibility-kit', '~> 22.0'
# Only needed whilst we are testing the formatters. Can be removed once we remove tests for those
s.add_development_dependency 'nokogiri', '~> 1.15'
s.add_development_dependency 'rake', '~> 13.2'
Expand Down
Loading