Skip to content

Add k6 Performance Test Project & CI Pipeline#3

Merged
QualityOwl merged 8 commits into
mainfrom
add_performance_tests
May 27, 2026
Merged

Add k6 Performance Test Project & CI Pipeline#3
QualityOwl merged 8 commits into
mainfrom
add_performance_tests

Conversation

@QualityOwl

Copy link
Copy Markdown
Owner

Summary

Adds a new k6 performance test project targeting the Restful Booker API and integrates it into a dedicated GitHub Actions pipeline.

Changes

Repository structure

  • Reorganized top-level folder structure to separate functional and performance test projects

CI pipeline

  • Renamed the existing functional tests workflow file for consistency
  • Added run-performance-tests.yaml — triggers on push/PR to main and workflow_dispatch; uses the official grafana/setup-k6-action and grafana/run-k6-action actions; passes BASE_URL, API_USERNAME, and API_PASSWORD via repository secrets with in-script defaults as fallback

k6 performance test project (Restful.Booker.Api.PerformanceTests)

  • config/environments.js — shared base URL and credentials sourced from environment variables
  • config/thresholds.js — shared threshold definitions (http_req_failed < 1%, p(95) < 3s, checks > 95%)
  • helpers/auth-helper.js — shared helper to obtain an auth token via POST /auth
  • tests/ping-performance-tests.js — load test for GET /ping
  • tests/auth-performance-tests.js — load test for POST /auth
  • tests/booking-performance-tests.js — full CRUD lifecycle load test (GET, POST, GET /{id}, PUT /{id}, DELETE /{id}) with per-endpoint tagged thresholds

Testing

All three test suites pass locally against https://restful-booker.herokuapp.com:

Copilot AI review requested due to automatic review settings May 27, 2026 17:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new k6-based performance test suite for the Restful Booker API and wires it into GitHub Actions, while also reorganizing/renaming the existing functional test project and workflow to align with the new structure.

Changes:

  • Introduced Restful.Booker.Api.PerformanceTests (k6 scripts, shared env/threshold config, auth helper) to run ping/auth/booking lifecycle load tests.
  • Reorganized solution/project layout and updated the root .slnx to point at the renamed functional test project.
  • Added a dedicated GitHub Actions workflow for performance tests and renamed the functional workflow for consistency.

Reviewed changes

Copilot reviewed 14 out of 25 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Restful.Booker.Api/Restful.Booker.Api.slnx Removes old solution location under Restful.Booker.Api/.
Restful.Booker.Api.slnx Adds new root solution referencing the functional test project.
Restful.Booker.Api.PerformanceTests/config/environments.js Centralizes k6 environment configuration (base URL + credentials).
Restful.Booker.Api.PerformanceTests/config/thresholds.js Defines shared k6 thresholds for error rate, latency, and checks.
Restful.Booker.Api.PerformanceTests/helpers/auth-helper.js Adds shared helper to obtain an auth token for k6 tests.
Restful.Booker.Api.PerformanceTests/tests/ping-performance-tests.js Adds k6 load test for GET /ping with tagged threshold.
Restful.Booker.Api.PerformanceTests/tests/auth-performance-tests.js Adds k6 load test for POST /auth with tagged threshold.
Restful.Booker.Api.PerformanceTests/tests/booking-performance-tests.js Adds k6 CRUD lifecycle load test for bookings with per-endpoint thresholds.
Restful.Booker.Api.PerformanceTests/package.json Adds convenience npm scripts to run individual/all k6 suites locally.
Restful.Booker.Api.FunctionalTests/Restful.Booker.Api.FunctionalTests.csproj Introduces the renamed functional test project configuration and dependencies.
Restful.Booker.Api.FunctionalTests/xunit.runner.json Adds xUnit runner configuration for the functional test project.
Restful.Booker.Api.FunctionalTests/Config/ApiSettings.cs Adds typed configuration binding for API settings and credentials.
Restful.Booker.Api.FunctionalTests/Config/TestConfiguration.cs Adds configuration loading/binding for functional tests.
Restful.Booker.Api.FunctionalTests/Config/appsettings.json Adds default API settings for functional tests.
Restful.Booker.Api.FunctionalTests/Fixtures/TestFixture.cs Adds shared fixture with HttpClient + token acquisition for functional tests.
Restful.Booker.Api.FunctionalTests/Models/*.cs Adds DTOs for auth/booking payloads used in functional tests.
Restful.Booker.Api.FunctionalTests/Controllers/*_FunctionalTests.cs Renames/aligns controller test classes to “FunctionalTests”.
.github/workflows/run-functional-tests.yaml Renames workflow and adjusts permissions (but needs fixes).
.github/workflows/run-performance-tests.yaml Adds new CI workflow to run k6 performance test suites.
Comments suppressed due to low confidence (2)

.github/workflows/run-functional-tests.yaml:13

  • permissions.contents is set to reads, but valid values are read, write, or none. As written, the workflow will fail to validate/apply permissions; change it to read.
    .github/workflows/run-functional-tests.yaml:4
  • This workflow still restores/builds/tests Restful.Booker.Api/Restful.Booker.Api.slnx, but the repo now has the solution at the root (Restful.Booker.Api.slnx) and no Restful.Booker.Api/ directory. Update the dotnet restore/build/test commands to use the new solution path so CI doesn't fail.

Comment thread .github/workflows/run-performance-tests.yaml
Comment thread Restful.Booker.Api.PerformanceTests/helpers/auth-helper.js
@QualityOwl QualityOwl merged commit 11c4aeb into main May 27, 2026
2 of 3 checks passed
@QualityOwl QualityOwl deleted the add_performance_tests branch May 27, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants