Skip to content

Commit

Permalink
add cucumber test framework
Browse files Browse the repository at this point in the history
  • Loading branch information
j-white committed May 4, 2024
1 parent 2fc9655 commit 0d61876
Show file tree
Hide file tree
Showing 7 changed files with 5,693 additions and 549 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ jobs:
worker-build --release
- name: Run (Rust) unit tests
run: cargo test
- name: Install Node dependencies
run: npm install
- name: Run (Node) integration tests
run: npm run cucumber
14 changes: 14 additions & 0 deletions cucumber.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// cucumber.js
let common = [
'features/**/*.feature', // Specify our feature files
'--require-module ts-node/register', // Load TypeScript module
'--require features/**/*.ts', // Load step definitions
'-f @cucumber/pretty-formatter',
// '-t @new',
'--no-strict',
'--force-exit',
].join(' ');

module.exports = {
default: common
};
7 changes: 7 additions & 0 deletions features/o11y.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Feature: OpenTelemetry metrics
Scenario: Worker metrics published
Given Worker is configured to point to mock Cloudflare API
Given Worker is configured to send metrics to a mock OpenTelemetry collector
When Worker is triggered
Then Worker metrics are published
And Meter name should include "cloudflare_worker_requests"
27 changes: 27 additions & 0 deletions features/step_definitions/o11y_steps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import {Given, When, Then} from '@cucumber/cucumber';

Given('Worker is configured to point to mock Cloudflare API', function () {
// Write code here that turns the phrase above into concrete actions
return 'pending';
});

Given('Worker is configured to send metrics to a mock OpenTelemetry collector', function () {
// Write code here that turns the phrase above into concrete actions
return 'pending';
});

When('Worker is triggered', function () {
// Write code here that turns the phrase above into concrete actions
return 'pending';
});

Then('Worker metrics are published', function () {
// Write code here that turns the phrase above into concrete actions
return 'pending';
});


Then('Meter name should include {string}', function (string) {
// Write code here that turns the phrase above into concrete actions
return 'pending';
});
Loading

0 comments on commit 0d61876

Please sign in to comment.