api-test

Automate NRF API and database tests using native fetch in Node.js.

Updated Feb 10, 2026
One-click install
npx skills add https://github.com/DEFRA/nrf-journey-tests --skill api-test-defra
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-test
Source: https://github.com/DEFRA/nrf-journey-tests/tree/main/.ai/skills/api-test
Command: npx skills add https://github.com/DEFRA/nrf-journey-tests --skill api-test-defra

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

NRF back-end services require reliable API and database validation to ensure endpoints respond correctly and data persists as expected. This Skill provides a structured suite of plain JavaScript tests (no Cucumber) that exercise the NRF backend components, reducing manual testing effort and accelerating CI feedback.

Core Features & Use Cases

  • Test structure: tests live in test/api for API endpoints and test/db for database interactions, with no Cucumber involved.
  • Plain JavaScript tests: uses native fetch (Node.js 22+) to perform HTTP requests and assertions.
  • Scope: supports health checks, example endpoints, and simple integration workflows across the two backend services (nrf-backend and nrf-impact-assessor).
  • These tests are designed to be run in local development, containerized environments with LocalStack, or CDP environments.

Quick Start

Run the API test suite against your NRF environment to validate endpoints and database interactions.

Frequently Asked Questions about api-test

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate API and database testing for NRF backend services?

To automate NRF API and database testing, run structured JavaScript test suites located in the test/api and test/db directories, which use native fetch to validate health endpoints, data persistence, and integration workflows.

Do I need Node.js 22 to run API tests using native fetch?

Yes, you need Node.js 22+ to run these API tests using native fetch. This version requirement ensures the test automation suite can execute HTTP requests and assertions without requiring external HTTP libraries or dependencies.

Can I validate backend endpoints locally using LocalStack for API testing?

Yes, you can validate backend endpoints locally using LocalStack. The test suite is designed to run reliably across local development, LocalStack containerized environments, and CDP environments by reading specific environment variables.

What environment variables are required for NRF API test automation?

NRF API test automation requires BACKEND_URL, IMPACT_URL, MONGODB_URI, and AWS_ENDPOINT environment variables. Configuring these variables ensures the tests can reliably connect to and validate the nrf-backend and nrf-impact-assessor services.

Does this API testing approach use Cucumber for backend test automation?

No, this API testing approach does not use Cucumber. It relies on plain JavaScript tests with native fetch to perform HTTP requests and assertions, avoiding Cucumber to reduce complexity and accelerate CI feedback for NRF services.

Why does my database integration test fail to validate data persistence?

Database integration tests validate data persistence by checking the MONGODB_URI environment variable. Ensure your MongoDB connection string is correctly configured for your local, dev, or CDP environment to prevent data persistence validation failures.