{"id":31897305,"url":"https://github.com/johnnynotsolucky/upcake","last_synced_at":"2025-10-13T11:19:25.957Z","repository":{"id":57671195,"uuid":"402203347","full_name":"johnnynotsolucky/upcake","owner":"johnnynotsolucky","description":"Fast, easy and consistent testing for HTTP APIs","archived":false,"fork":false,"pushed_at":"2021-12-07T20:24:28.000Z","size":416,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-19T13:14:21.909Z","etag":null,"topics":["assertions","cli","e2e-tests","http","rest","rust","test-automation","test-runner","test-suite","testing","testing-tools","tests"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johnnynotsolucky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-01T21:07:05.000Z","updated_at":"2023-02-13T23:21:09.000Z","dependencies_parsed_at":"2022-09-10T18:03:34.673Z","dependency_job_id":null,"html_url":"https://github.com/johnnynotsolucky/upcake","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/johnnynotsolucky/upcake","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnnynotsolucky%2Fupcake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnnynotsolucky%2Fupcake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnnynotsolucky%2Fupcake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnnynotsolucky%2Fupcake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnnynotsolucky","download_url":"https://codeload.github.com/johnnynotsolucky/upcake/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnnynotsolucky%2Fupcake/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279014772,"owners_count":26085594,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assertions","cli","e2e-tests","http","rest","rust","test-automation","test-runner","test-suite","testing","testing-tools","tests"],"created_at":"2025-10-13T11:19:21.093Z","updated_at":"2025-10-13T11:19:25.950Z","avatar_url":"https://github.com/johnnynotsolucky.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  🧁 Upcake\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cem\u003eCupcakes for your API\u003c/em\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/johnnynotsolucky/upcake/actions/workflows/build.yaml\"\u003e\u003cimg src=\"https://github.com/johnnynotsolucky/upcake/actions/workflows/build.yaml/badge.svg\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Overview\n\nUpcake enables assertions to be performed against HTTP requests. Requests and\ntheir assertions are defined in a YAML file and can have dependencies on each\nother, provided that dependency requests are named. Assertions can be against\nrequest timing data and any response data including headers, content and\nresponse code.\n\nThe request URL, headers and content support template rendering with\n[Handlebars](https://handlebarsjs.com/) using the\n[handlebars](https://docs.rs/handlebars/*/handlebars/) crate.\n\nRequests are run in parallel except where they have a dependency to another\nrequest in which case they will wait until their dependencies have completed\nbefore starting.\n\nThe response headers and content of a request is made available as part of the\ntemplate context for dependent requests.\n\n## Installation\n\n### With cargo\n\n```bash\ncargo install upcake\n```\n\n### From source\n\n```bash\ngit clone https://github.com/johnnynotsolucky/upcake.git\ncd upcake\ncargo install --path .\n```\n\n## Usage\n\n### Command-line options\n\n- `--env-var-prefix` - An optional prefix to filter environment variables\n  injected into the template context\n- `-k`, `--insecure` - Allow insecure server connections when using SSL\n- `-E`, `--cert` - Client certificate file\n- `--key` - Client private key file\n- `--cacert` - CA certificate to verify against\n- `-L`, `--location` - Follow redirects\n- `-v`, `--verbose` - Verbose output\n- `--fail-request` - Fail request on HTTP error response codes\n- `-s`, `--max-response-size` - Maximum response size in bytes\n- `-e`, `--extra-vars` Set additional variables as key=value or YAML. To use a\n  file, prepend the value with \"@\". Available in the template context in the `user` property.\n- `--connect-timeout` - Maximum time allowed for connection in milliseconds\n- `-c`, `--config-file` - Path to the request config file. Defaults to\n  \"Upcakefile.yaml\".\n\n**Note:** Configuration set from the command line will override configuration for that\nproperty set in the Upcakefile.\n\n### Configuration\n\n- `env_var_prefix` - An optional prefix to filter environment variables.\n  Overridden by `--env-var-prefix`.\n- `location` - Follow redirects. Overridden by `--insecure`.\n- `insecure` - Allow insecure server connections when using SSL. Overridden by\n  `--insecure`.\n- `client_cert` - Client certificate file. Overridden by `--cert`. Unless\n  absolute, path is relative to the directory of the config file.\n- `client_key` - Client private key file. Overridden by `--key`. Unless\n  absolute, path is relative to the directory of the config file.\n- `ca_cert` - CA certificate to verify against. Overridden by `--cacert`. Unless\n  absolute, path is relative to the directory of the config file.\n- `connect_timeout` - Maximum time allowed for connection. Overridden by\n  `--connect-timeout`.\n- `extra_vars` - Set additional variables from YAML mapping. Merged with vars\n  set with `--extra-vars`. Available in the template context in the `user` property.\n- `verbose` - Verbose output. Overridden by `--verbose`.\n- `fail_request` - Fail request on HTTP error response codes\n- `max_response_size` - Maximum response size in bytes. Overridden by\n  `--max-response-size`.\n- `requests` - List of request configurations.\n\n#### Example\n\n```yaml\nlocation: false\ninsecure: false\nca_cert: ca.pem\nclient_cert: client.pem\nclient_key: key.pem\nconnect_timeout: 100\nextra_vars:\n  my_var: Some Value\nverbose: true\nmax_response_size: 32000\nrequests:\n  - url: \"http://localhost:8888/post\"\n```\n\n### Request configuration\n\n- `name` _optional_ -  Name of the request.\n- `requires` _optional_ - List of named requests this request depends upon.\n- `request_method` _optional_ - The HTTP method to use. Defaults to \"GET\".\n- `data` _optional_ - Data to send with the request. Send the contents of a file by prefixing the value with an \"@\", for example \"@path/to/body/template.hbs\". Relative paths are relative to the directory of the loaded configuration file.\n- `headers` _optional_ - Either a list of headers or a template to render raw headers from.\n- `url`- The URL to make the request to.\n- `assertions` _optional_ - A list of assertions to perform on the response. Defaults to a HTTP 200 assertion.\n\n#### Example\n\n```yaml\n- name: \"Request B\"\n  requires: [\"Request A\"]\n  request_method: \"POST\"\n  data: \"@data.hbs\"\n  headers:\n    - name: Accept\n      value: application/json\n    - name: Content-Type\n      value: application/json\n  url: \"http://localhost:8888/post\"\n  assertions:\n    - type: equal\n      path: .\"response_code\"\n      value: 200\n```\n\n##### Header template\n\n```yaml\n- name: \"Request B\"\n  requires: [\"Request A\"]\n  request_method: \"GET\"\n  url: \"http://localhost:8888/get\"\n  headers: |\n    Accept: application/json\n    {{#each requests.[Request A].headers}}\n      {{#if (eqi name \"Set-Cookie\")}}\n    Cookie: {{value}}\n      {{/if}}\n    {{/each}}\n```\n\n### Assertion configuration\n\n- `type` - The type of assertion to use. See [available assertions](#available-assertions).\n- `path` - The [jql](https://crates.io/crates/jql) path to the field the assertion should run against. Defaults to `.`. `path` is ignored on inner assertions, for example the [length](#length) assertion.\n- `skip` _optional_ - Whether to skip the assertion. If set, requires a string value for the reason.\n- `assertion` - The assertion to apply\n\n\n#### Example\n\n```yaml\n- type: length\n  path: .\"content\".\"slideshow\".\"slides\".[]\n  skip: Some reason for skipping the assertion\n  assertion:\n    type: equal\n    value: 2\n```\n\n### Available assertions\n\nIn addition to the top-level assertion configuartion, each assertion has its own properties which are required to be set.\n\n####  Between\n\nType: `between`\n\nAssert that a value is within a range.\n\n- `min` - Start of range.\n- `max` - End of range.\n- `inclusive` _optional_ - Whether to include `min` and `max`in the assertion.\n\n##### Example\n\n```yaml\n- type: between\n  path: .\"response_code\"\n  min: 200\n  max: 399\n  inclusive: true\n```\n\n#### Equal\n\nType: `equal`\n\nAssert that a value equals the given value.\n\n- `value` - Value to assert.\n\n##### Example\n\n```yaml\n- type: equal\n  path: .\"response_code\"\n  value: 200\n```\n\n#### Not Equal\n\nType: `not-equal`\n\nAssert that a value is not equal to the given value.\n\n- `value` - Value to assert.\n\n##### Example\n\n```yaml\n- type: not-equal\n  path: .\"response_code\"\n  value: 204\n```\n\n#### Length\n\nType: `length`\n\nAssert that the length of a value passes the given assertion\n\n- `assertion` - Any assertion with the same configuration defined in [assertion configuration](#assertion-configuration).\n\n##### Example\n\n```yaml\n- type: length\n  path: .\"headers\".[]\n  assertion:\n    - type: equal\n      value: 5\n```\n\n#### Contains\n\nType: `contains`\n\nAssert that a response value contains the given value.\n\n- For strings, it asserts that the substring is present in the value;\n- For arrays, it asserts that the value is present in the array;\n- For mappings (dictionary/object types), asserts that the input map is present in the response map.\n\n- `value` - The value to assert is contained in the given value.\n\n##### Examples\n\n**Assert mapping contains all key/value pairs**\n\n```yaml\n- type: contains\n  path: .\"content\".{}\n  value:\n    key: Value\n    another_property: Some other value\n```\n\n**Assert array contains a value**\n\n```yaml\n- type: contains\n  path: .\"content\".\"my_integer_array\".[]\n  value: 10\n```\n\nor\n\n```yaml\n- type: contains\n  path: .\"content\".\"my_object_array\".[]\n  value:\n    id: item_10\n    value: Item Value\n```\n\n**Assert substring appears in response value**\n\n```yaml\n- type: contains\n  path: .\"content\".\"my_string\"\n  value: \"value\"\n```\n\n#### Exists\n\nType: `exists`\n\nAssert that the given value exists as a key in the response value.\n\n- `value` - The value to assert exists in the given mapping.\n\n##### Example\n\n```yaml\n- type: exists\n  path: .\"content\".\"my_object\".{}\n  value: id\n```\n\n#### Greater than\n\nType: `greater-than`\n\nAssert that a value is greater than the given value.\n\n- `value` - Value to assert.\n\n##### Example\n\n```yaml\n- type: greater-than\n  path: .\"response_code\"\n  value: 200\n```\n\n#### Greater than equal\n\nType: `greater-than-equal`\n\nAssert that a value is greater or equal to the given value.\n\n- `value` - Value to assert.\n\n##### Example\n\n```yaml\n- type: greater-than-equal\n  path: .\"response_code\"\n  value: 200\n```\n\n#### Less than\n\nType: `less-than`\n\nAssert that a value is less than the given value\n\n- `value` - Value to assert.\n\n##### Example\n\n```yaml\n- type: less-than\n  path: .\"response_code\"\n  value: 400\n```\n\n#### Less than equal\n\nType: `less-than-equal`\n\nAssert that a value is less than or equal to the given value\n\n- `value` - Value to assert.\n\n##### Example\n\n```yaml\n- type: less-than-equal\n  path: .\"timing\".\"starttransfer\"\n  value: 100\n```\n\n### Response data\n\n#### Request result\n\n- `http_version` - The HTTP version used for the request.\n- `response_code` - The HTTP response code returned.\n- `response_message` - A HTTP response message returned from the host, if any.\n- `headers` - A list of response headers.\n- `timing` - Response timing data. See [timing results](#timing-results).\n- `content` - Response content, either formatted as JSON, or raw content if it\ncouldn't be parsed as JSON.\n\n#### Timing results\n\n- `namelookup` - Duration in milliseconds from the start of the request until\nname lookup resolved.\n- `connect` - Duration in milliseconds from the start of the request until a\nconnection to the remote host is established.\n- `pretransfer` - Duration in milliseconds from the start of the request until\nfile transfer was about to begin.\n- `starttransfer` - Duration in milliseconds from the start of the request until\nthe first byte was received. AKA TTFB.\n- `total` - Duration in milliseconds from the start of the request until the\nrequest ended.\n- `dns_resolution` - Alias for `namelookup`.\n- `tcp_connection` - Difference of `connect` and `namelookup`.\n- `tls_connection` - Difference of `pretransfer` and `connect`.\n- `server_processing` - Difference of `starttransfer` and `pretransfer`.\n- `content_transfer` - Difference of `total` and `starttransfer`.\n\n### Templating\n\nThe request URL, headers and content support template rendering with\n[Handlebars](https://handlebarsjs.com/) using the\n[handlebars](https://docs.rs/handlebars/*/handlebars/) crate.\n\nThe response headers and content of a request is made available as part of the\ntemplate context for dependent requests.\n\n#### Available elements\n\n##### `user`\n\nOptional user-provided context. This is set via the\n[`--extra-vars`](#command-line-options) flag and/or with the\n[`extra_vars`](#configuration) configuration property in the config file.\n\n##### `env`\n\nA map of the environment variables available to the program at runtime. Setting\na prefix with [`--env-var-prefix`](#command-line-options) or the\n[`env_var_prefix`](#configuration) config option will remove any environment\nvariables which are not prefixed with that value.\n\n##### `requests`\n\nA map of requests keyed by request name. Only requests which are set in the\n[`requires`](#request-configuration) property of the request configuration are\nincluded. Requests which have not yet executed or completed will not be\navailable until they have completed.\n\n#### Helpers\n\n- [Built-in\n  helpers](https://docs.rs/handlebars/*/handlebars/#built-in-helpers)\n- Boolean helpers:\n  - `eqi` - Case-insensitive equals\n  - `nei` - Case-insensitive not equals\n\n## Examples\n\nExamples are in [examples](examples/).\n\nThey are configured to run against a local [httpbin](https://httpbin.org/) server.\n\n### httpbin Server\n\n#### Start with docker\n\n```bash\ndocker run -p 8888:80 kennethreitz/httpbin\n```\n\n#### Start with docker-compose\n\n```bash\ndocker-compose --file examples/docker-compose.yaml up\n```\n\n### Run the examples\n\n```bash\nupcake --config-file examples/basic.yaml\nAUTH_TOKEN=my_token upcake --config-file ./examples/pipeline.yaml\nupcake --config-file examples/mtls.yaml\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnnynotsolucky%2Fupcake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnnynotsolucky%2Fupcake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnnynotsolucky%2Fupcake/lists"}