adb-tests-artillery
AI-generated content
This document was generated by an AI assistant. Verify accuracy before relying on the details.
Role
End-to-end load and API validation testing suite based on Artillery.js. It targets the public gateway (BE_HOST), authenticates via Keycloak, populates/cleans MongoDB directly, and verifies REST endpoint behaviour under load.
Run as a Bitbucket pipeline with various profiles (ENV_NAME, CLEANUP_BEFORE).
Stack
| Item | Value |
|---|---|
| Artillery | 2.0.18 |
| Node.js | 23.6.1 (Alpine for CI) or 18.20.3 |
| MongoDB driver | mongodb 6.9.0 |
| Test data | Google Sheets (google-spreadsheet) |
| Templating | Mustache |
Structure
adb-tests-artillery/
├── tests/
│ ├── 01-setup/ User profile retrieval
│ ├── 02-create/ CRUD: owner, tenant, supplier,
│ │ part, file, ticket, RDC, RC,
│ │ call-rc-first-rent, call-rc-regular-rent
│ └── 03-apicheck/ API validation per domain
│ ├── accounting/ ledger-account, accounting-entries,
│ │ ledger-auxiliary-account, accounting-event
│ └── persons/ tenant, person, organization
├── envs/ .env files per environment
├── utils/ utility scripts
│ ├── env-activation.mjs loads .env
│ ├── g-sheet.mjs Google Sheets extraction
│ ├── switching-data.mjs data switching
│ └── data-cleanup.mjs MongoDB cleanup
├── reports/ Mochawesome output (CI artifact)
├── config.yml Artillery config
└── bitbucket-pipelines.yml custom pipeline
Test architecture
flowchart TB
PreSetup[Pre-setup<br/>g-sheet → fixtures]
Cleanup[Data cleanup<br/>direct MongoDB]
Auth[Keycloak auth<br/>POST /realms/ADB/protocol/openid-connect/token]
Tests[Artillery scenarios]
Reports[reports/*.json<br/>Mochawesome format]
GS[Google Sheets<br/>GOOGLE_SHEET_ID]
Mongo[(MongoDB Atlas)]
KC[Keycloak]
Backend[adb-* via BE_HOST]
PreSetup --> GS
Cleanup --> Mongo
Auth --> KC
Tests --> Backend
Tests --> Reports
Environment variables
| Variable | Role |
|---|---|
MONGO_DB_URL_<ENV_NAME> | MongoDB connection string per env |
BE_HOST | Backend (gateway) URL |
ADMIN_USERNAME / ADMIN_PASSWORD | Keycloak admin credentials |
G_CONFIG | Google Sheets credentials |
GOOGLE_SHEET_ID | ID of the test-data sheet |
ENV_NAME | dev / athena / hephaestus / int |
CLEANUP_BEFORE | full / partial / no |
Main commands
npm run utils-activate-all # Full setup
npm run utils-cleanup-all # Cleanup of 13+ collections
npm run utils-cleanup-partial # Partial cleanup
npm run create-all # Create all test items
npm run create-organization
npm run create-fiscal-year
npm run create-owner / tenant / supplier
npm run create-part / file / rdc / rc
npm run test-api-accounting # Accounting API tests
npm run test-api-persons
Each command produces a reports/*.json report in Mochawesome format.
Bitbucket pipeline
Custom pipeline (manually triggered):
image: node:23.6.1-alpine
stages:
- npm install
- utils-activate-all
- cleanup (depending on CLEANUP_BEFORE)
- run Artillery scenarios
artifacts: reports/**
Main scenarios
- 01-setup — admin login, representative login.
- 02-create — full dataset creation: organisation, fiscal year, owners, tenants, suppliers, bank accounts, parts, files, tickets, RDC and RC contracts, first rents and recurring rents.
- 03-apicheck — endpoint verification per domain:
accounting/: ledger-account, accounting-entries, ledger-auxiliary-account, accounting-event.persons/: tenant, person, organization.
Links
- Code:
adb-tests-artillery/ - CFR stress test doc:
technical-epics/stress-test/i-can-stress-test-the-cfr.md - Historical reports:
technical-epics/stress-test/reports/