---
title: "POST /v1/{+name}:test"
method: POST
path: "/v1/{+name}:test"
tags: ["projects"]
---

# POST /v1/{+name}:test

`POST /v1/{+name}:test`

Test `Source` for syntactic and semantic correctness. Issues present, if any, will be returned to the caller with a description, severity, and source location. The test method may be executed with `Source` or a `Ruleset` name. Passing `Source` is useful for unit testing new rules. Passing a `Ruleset` name is useful for regression testing an existing rule. The following is an example of `Source` that permits users to upload images to a bucket bearing their user id and matching the correct metadata: _*Example*_ // Users are allowed to subscribe and unsubscribe to the blog. service firebase.storage { match /users/{userId}/images/{imageName} { allow write: if userId == request.auth.uid && (imageName.matches('*.png$') || imageName.matches('*.jpg$')) && resource.mimeType.matches('^image/') } }

## Path parameters

- `name` string, required

## Request body

- TestRulesetRequest — The request for FirebaseRulesService.TestRuleset.
  - `testSuite` TestSuite — `TestSuite` is a collection of `TestCase` instances that validate the logical correctness of a `Ruleset`. The `TestSuite` may be referenced in-line within a `TestRuleset` invocation or as part of a `Release` object as a pre-release check.
    - `testCases` TestCase[] — Collection of test cases associated with the `TestSuite`.
      - `request` unknown
      - `functionMocks` FunctionMock[] — Optional function mocks for service-defined functions. If not set, any service defined function is expected to return an error, which may or may not influence the test outcome.
        - `function` string — The name of the function. The function name must match one provided by a service declaration.
        - `result` Result — Possible result values from the function mock invocation.
          - `value` unknown
          - `undefined` Empty — A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
        - `args` Arg[] — The list of `Arg` values to match. The order in which the arguments are provided is the order in which they must appear in the function invocation.
          - `exactValue` unknown
          - `anyValue` Empty — A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
      - `resource` unknown
      - `expectation` 'EXPECTATION_UNSPECIFIED' | 'ALLOW' | 'DENY' — Test expectation.
      - `expressionReportLevel` 'LEVEL_UNSPECIFIED' | 'NONE' | 'FULL' | 'VISITED' — Specifies what should be included in the response.
      - `pathEncoding` 'ENCODING_UNSPECIFIED' | 'URL_ENCODED' | 'PLAIN' — Specifies whether paths (such as request.path) are encoded and how.
  - `source` Source — `Source` is one or more `File` messages comprising a logical set of rules.
    - `files` File[] — Required. `File` set constituting the `Source` bundle.
      - `name` string — Required. File name.
      - `content` string — Required. Textual Content.
      - `fingerprint` string, byte — Fingerprint (e.g. github sha) associated with the `File`.

## Response `200`

Successful response

---

[API](https://skmtc.dev/google/apis/firebaserules.md) · [All operations](https://skmtc.dev/google/apis/firebaserules/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/google/firebaserules/revisions/d3ce1431eabc/schema)
