TestSuite.schema.json

Introduction

In this document, we will explore the Cerbos policy testing framework, which provides a structured way to define and execute tests against your policy definitions.

Test Suite Structure

A typical test suite consists of several key components:

Example Test Table

Test Table Structure

Each test table includes:

Sample Test Table

{
  "name": "Sample Test",
  "input": {
    "principals": ["user123"],
    "actions": ["read"],
    "resources": ["resourceA"]
  },
  "expected": [
    {
      "principal": "user123",
      "resource": "resourceA",
      "actions": {
        "read": "EFFECT_ALLOW"
      }
    }
  ]
}

Conclusion

Utilizing this structured framework allows for robust testing of your policies, ensuring that they behave as expected.