From 7067e6325aa062591745c3f6f9dc166b7ebabfdf Mon Sep 17 00:00:00 2001 From: Gordon Chan Date: Wed, 28 May 2025 12:56:30 +1200 Subject: [PATCH] [TE-3868] WIP - Add cucumber test example with prototype integration with Ruby Collector --- cucumber/Gemfile | 5 ++ cucumber/Gemfile.lock | 87 +++++++++++++++++++++++ cucumber/features/sample.feature | 7 ++ cucumber/step_definitions/sample_steps.rb | 12 ++++ 4 files changed, 111 insertions(+) create mode 100644 cucumber/Gemfile create mode 100644 cucumber/Gemfile.lock create mode 100644 cucumber/features/sample.feature create mode 100644 cucumber/step_definitions/sample_steps.rb diff --git a/cucumber/Gemfile b/cucumber/Gemfile new file mode 100644 index 0000000..f91f227 --- /dev/null +++ b/cucumber/Gemfile @@ -0,0 +1,5 @@ +source 'https://rubygems.org' + +gem 'cucumber' +gem 'rspec' +gem 'buildkite-test_collector', git: 'https://github.com/buildkite/test-collector-ruby.git', ref: '863e7fcc5a25457a06a09d223a7f9ae353ce9254' diff --git a/cucumber/Gemfile.lock b/cucumber/Gemfile.lock new file mode 100644 index 0000000..d3f7eb9 --- /dev/null +++ b/cucumber/Gemfile.lock @@ -0,0 +1,87 @@ +GIT + remote: https://github.com/buildkite/test-collector-ruby.git + revision: 863e7fcc5a25457a06a09d223a7f9ae353ce9254 + ref: 863e7fcc5a25457a06a09d223a7f9ae353ce9254 + specs: + buildkite-test_collector (2.9.0) + +GEM + remote: https://rubygems.org/ + specs: + bigdecimal (3.1.9) + builder (3.3.0) + cucumber (9.2.1) + builder (~> 3.2) + cucumber-ci-environment (> 9, < 11) + cucumber-core (> 13, < 14) + cucumber-cucumber-expressions (~> 17.0) + cucumber-gherkin (> 24, < 28) + cucumber-html-formatter (> 20.3, < 22) + cucumber-messages (> 19, < 25) + diff-lcs (~> 1.5) + mini_mime (~> 1.1) + multi_test (~> 1.1) + sys-uname (~> 1.2) + cucumber-ci-environment (10.0.1) + cucumber-core (13.0.3) + cucumber-gherkin (>= 27, < 28) + cucumber-messages (>= 20, < 23) + cucumber-tag-expressions (> 5, < 7) + cucumber-cucumber-expressions (17.1.0) + bigdecimal + cucumber-gherkin (27.0.0) + cucumber-messages (>= 19.1.4, < 23) + cucumber-html-formatter (21.9.0) + cucumber-messages (> 19, < 28) + cucumber-messages (22.0.0) + cucumber-tag-expressions (6.1.2) + diff-lcs (1.6.2) + ffi (1.17.2) + ffi (1.17.2-aarch64-linux-gnu) + ffi (1.17.2-aarch64-linux-musl) + ffi (1.17.2-arm-linux-gnu) + ffi (1.17.2-arm-linux-musl) + ffi (1.17.2-arm64-darwin) + ffi (1.17.2-x86-linux-gnu) + ffi (1.17.2-x86-linux-musl) + ffi (1.17.2-x86_64-darwin) + ffi (1.17.2-x86_64-linux-gnu) + ffi (1.17.2-x86_64-linux-musl) + mini_mime (1.1.5) + multi_test (1.1.0) + rspec (3.13.1) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.4) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.5) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.5) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.4) + sys-uname (1.3.1) + ffi (~> 1.1) + +PLATFORMS + aarch64-linux-gnu + aarch64-linux-musl + arm-linux-gnu + arm-linux-musl + arm64-darwin + ruby + x86-linux-gnu + x86-linux-musl + x86_64-darwin + x86_64-linux-gnu + x86_64-linux-musl + +DEPENDENCIES + buildkite-test_collector! + cucumber + rspec + +BUNDLED WITH + 2.6.8 diff --git a/cucumber/features/sample.feature b/cucumber/features/sample.feature new file mode 100644 index 0000000..ea2fcf2 --- /dev/null +++ b/cucumber/features/sample.feature @@ -0,0 +1,7 @@ +# Sample Feature +Feature: Sample feature to demonstrate Cucumber + + Scenario: Simple addition + Given I have two numbers 2 and 3 + When I add them + Then the result should be 5 diff --git a/cucumber/step_definitions/sample_steps.rb b/cucumber/step_definitions/sample_steps.rb new file mode 100644 index 0000000..58bb743 --- /dev/null +++ b/cucumber/step_definitions/sample_steps.rb @@ -0,0 +1,12 @@ +Given('I have two numbers {int} and {int}') do |int, int2| + @number1 = int + @number2 = int2 +end + +When('I add them') do + @result = @number1 + @number2 +end + +Then('the result should be {int}') do |int| + expect(@result).to eq(int) +end