Skip to content

S3#

Steps for interacting with S3-compatible object storage (MinIO, LocalStack, AWS)

Multi-line Content

Steps ending with : accept multi-line content using Gherkin's docstring syntax ("""). See examples below each section.

Bucket Setup#

Step Description
"files" bucket "uploads" exists Create a bucket if it does not already exist
"files" bucket "uploads" is empty Delete every object in a bucket
"files" bucket "uploads" is deleted Delete a bucket and everything in it

Object Setup#

Step Description
"files" object "uploads/hello.txt" is "hello world" Write an object with inline content (path is bucket/key)
"files" object "uploads/user.json" is: Write an object with multiline content (docstring)
"files" object "uploads/a.csv" is "id,name" with content type "text/csv" Write an object with an explicit content type
"files" object "uploads/logo.png" is file "testdata/logo.png" Upload a local file as an object
"files" object "uploads/hello.txt" is deleted Delete a single object
"files" objects: Seed multiple objects from a table with path and content columns

Examples#

Write an object with multiline content (docstring):

"files" object "uploads/user.json" is:
  """
  {"id": 1, "name": "John"}
  """

Seed multiple objects from a table with path and content columns:

"files" objects:
  | path                | content     |
  | uploads/a.txt       | first       |
  | uploads/b.txt       | second      |

Bucket Assertions#

Step Description
"files" bucket "uploads" should exist Assert a bucket exists
"files" bucket "temp" should not exist Assert a bucket does not exist
"files" bucket "uploads" should have "3" objects Assert the object count in a bucket
"files" bucket "uploads" should be empty Assert a bucket holds no objects
"files" bucket "uploads" should have "2" objects with prefix "2026/" Assert the object count under a key prefix
"files" bucket "uploads" should have "1" objects within "10s" Wait for a bucket to reach an object count (async writes)

Object Assertions#

Step Description
"files" object "uploads/hello.txt" should exist Assert an object exists
"files" object "uploads/gone.txt" should not exist Assert an object does not exist
"files" object "uploads/report.pdf" should exist within "10s" Wait for an object to appear (async writes)
"files" object "uploads/hello.txt" content should be "hello world" Assert exact object content
"files" object "uploads/hello.txt" content should be: Assert exact object content (docstring)
"files" object "uploads/log.txt" content should contain "ERROR" Assert object content contains a substring
"files" object "uploads/user.json" content should match: Assert object JSON content matches (partial, supports @matchers)
"files" object "uploads/hello.txt" size should be "11" bytes Assert object size in bytes
"files" object "uploads/a.csv" content type should be "text/csv" Assert object content type
"files" object "uploads/a.csv" metadata "owner" should be "billing" Assert a user metadata value on an object

Examples#

Assert exact object content (docstring):

"files" object "uploads/hello.txt" content should be:
  """
  hello world
  """

Assert object JSON content matches (partial, supports @matchers):

"files" object "uploads/user.json" content should match:
  """
  {"id": "@number", "name": "John"}
  """

Capture#

Step Description
"files" object "uploads/id.txt" content is captured as "user_id" Store object content in a variable for later steps