catalyst 0.2.8

A lightweight API testing tool
Documentation
[config]
base_url = "https://httpbin.org"
default_headers = { "Content-Type" = "application/json" }

# Test 1: Basic test with simple assertion
[[tests]]
name = "Basic Test"
method = "GET"
endpoint = "/get"
expected_status = 200

[[tests.assertions]]
type = "Contains"
value = { "url" = "https://httpbin.org/get" }

# Test 2: Test with request body and complex assertions
[[tests]]
name = "Complex Test"
method = "POST"
endpoint = "/post"
expected_status = 200

[tests.body]
name = "Test User"
email = "test@example.com"

[[tests.assertions]]
type = "Contains"

[tests.assertions.value]
url = "https://httpbin.org/post"

[tests.assertions.value.json]
name = "Test User"

[[tests.assertions]]
type = "PathRegex"
value = ["$.json.email", "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"]

# Test 3: Variable storage test
[[tests]]
name = "Variable Storage Test"
method = "POST"
endpoint = "/post"
expected_status = 200

[tests.body]
id = "12345"
name = "Test Resource"

[tests.store]
"$.json.id" = "resource_id"
"$.json.name" = "resource_name"

# Test 4: Variable usage test
[[tests]]
name = "Variable Usage Test"
method = "GET"
endpoint = "/get"
expected_status = 200

[tests.query_params]
id = "${{resource_id}}"
name = "${{resource_name}}"

[tests.headers]
"X-Resource-ID" = "${{resource_id}}"

[[tests.assertions]]
type = "Contains"

[tests.assertions.value.args]
id = "12345"
name = "Test Resource"

# Test 5: Response time validation
[[tests]]
name = "Response Time Test"
method = "GET"
endpoint = "/get"
expected_status = 200
max_response_time = 1000

# Test 6: Expected body validation
[[tests]]
name = "Expected Body Test"
method = "GET"
endpoint = "/get"
expected_status = 200

[tests.expected_body]
url = "https://httpbin.org/get"

[tests.expected_body.args]

# Test 7: Multiple assertions of different types
[[tests]]
name = "Multiple Assertions Test"
method = "GET"
endpoint = "/get"
expected_status = 200

[[tests.assertions]]
type = "Exact"

[tests.assertions.value]
url = "https://httpbin.org/get"
args = {}

[[tests.assertions]]
type = "Regex"
value = ".*\"url\":\\s*\"https://httpbin.org/get\".*"

[[tests.assertions]]
type = "PathRegex"
value = ["$.url", "^https://httpbin.org/get$"]

[[tests]]
name = "Current User Test"
method = "POST"
endpoint = "/post"
expected_status = 200
body = { "username" = "${{USER}}" }

assertions = [
  { "type" = "Contains", "value" = { "json" = { "username" = "${{USER}}" } } },
]

store = { "$.json.username" = "current_user" }