api-testing-patterns

Automate RBAC and API behavior verification with Laravel integration and feature tests.

Updated Apr 10, 2026
One-click install
npx skills add https://github.com/majedsiefalnasr/bunyan-app-cursor --skill api-testing-patterns-majedsiefalnasr
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-testing-patterns
Source: https://github.com/majedsiefalnasr/bunyan-app-cursor/tree/main/.agents/skills/api-testing-patterns
Command: npx skills add https://github.com/majedsiefalnasr/bunyan-app-cursor --skill api-testing-patterns-majedsiefalnasr

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

RBAC and API complexity often cause security gaps and regressions. This skill provides structured patterns and examples to validate role-based access and ensure consistent API behavior across authentication, authorization, and resource access.

Core Features & Use Cases

  • RBAC testing patterns for Auth, Projects, and Orders to verify correct access control across roles.
  • Structured test structure with Unit and Feature tests to cover models, services, enums, and API endpoints.
  • Factory-based roles and assertions demonstrating customer, contractor, and admin workflows, ensuring proper HTTP responses and data integrity.
  • Real-world scenarios like user login, project creation, and restricted access enforcement to illustrate end-to-end testing flows.

Quick Start

Run the Laravel test suite to verify RBAC patterns against the API.

Frequently Asked Questions about api-testing-patterns

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

FAQPage Schema
How do I test RBAC permissions in a Laravel API?

Laravel API RBAC testing verifies role-based access control by running feature tests against endpoints. It uses factory-based roles for customers, contractors, and admins to assert allowed and forbidden HTTP statuses across projects, orders, and authentication.

What is the best way to structure Laravel integration tests for role-based access control?

The best way to structure Laravel integration tests for role-based access control is to separate Unit and Feature tests. This structure covers models, services, enums, and API endpoints while demonstrating patterns for allowed and forbidden actions.

Can I use factory-based user roles to test authentication flows in Laravel?

Yes, you can use factory-based user roles to test authentication flows in Laravel. This approach demonstrates real-world scenarios like user login, project creation, and restricted access enforcement across different user types.

Does this API testing approach work with Laravel endpoints under /api/v1?

Yes, this API testing approach works with Laravel endpoints under /api/v1. It validates role-based access control scenarios across projects, orders, and authentication for Laravel-based APIs.

Why do I need RefreshDatabase for testing Laravel API behavior?

You need RefreshDatabase for testing Laravel API behavior to ensure a clean database state between tests. This prevents data integrity issues when automating verification of RBAC and API behavior across multiple test runs.