{"id":13564388,"url":"https://github.com/hofstadter-io/frisby","last_synced_at":"2025-10-25T14:50:03.374Z","repository":{"id":57564592,"uuid":"42525006","full_name":"hofstadter-io/frisby","owner":"hofstadter-io","description":"API testing framework inspired by frisby-js","archived":false,"fork":false,"pushed_at":"2020-03-03T23:49:00.000Z","size":43,"stargazers_count":277,"open_issues_count":12,"forks_count":27,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-04-23T07:16:29.406Z","etag":null,"topics":["api-testing-framework","frisby","frisby-js","golang","testing"],"latest_commit_sha":null,"homepage":null,"language":"Go","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/hofstadter-io.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":"2015-09-15T14:35:58.000Z","updated_at":"2024-02-06T14:29:30.000Z","dependencies_parsed_at":"2022-09-18T04:52:09.323Z","dependency_job_id":null,"html_url":"https://github.com/hofstadter-io/frisby","commit_stats":null,"previous_names":["verdverm/frisby"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hofstadter-io%2Ffrisby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hofstadter-io%2Ffrisby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hofstadter-io%2Ffrisby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hofstadter-io%2Ffrisby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hofstadter-io","download_url":"https://codeload.github.com/hofstadter-io/frisby/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247082945,"owners_count":20880749,"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","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":["api-testing-framework","frisby","frisby-js","golang","testing"],"created_at":"2024-08-01T13:01:30.503Z","updated_at":"2025-10-25T14:49:58.340Z","avatar_url":"https://github.com/hofstadter-io.png","language":"Go","funding_links":[],"categories":["Go","Testing","Testing Frameworks"],"sub_categories":["Testing Frameworks"],"readme":"# frisby\n\n[![Build Status](https://travis-ci.org/verdverm/frisby.svg?branch=master)](https://travis-ci.org/verdverm/frisby)\n[![GoDoc](https://godoc.org/github.com/verdverm/frisby?status.svg)](https://godoc.org/github.com/verdverm/frisby)\n[![GitHub release](https://img.shields.io/github/release/qubyte/rubidium.svg)](https://github.com/verdverm/frisby)\n\nREST API testing framework inspired by frisby-js, written in Go\n### Proposals\n\nI'm starting to work on `frisby` again with the following ideas:\n\n1. Read specification files\n  - pyresttest\n  - frisby.js\n  - swagger spec\n  - other?\n1. Use as a load tester\n  - like Locust.io\n  - distributed\n1. UI\n  - Dashboard\n  - Analytics\n  - Reports\n  - Manage multiple instances\n2. Backend\n  - master/minions\n  - db for analytics\n  - api for UI / clients [Goa](http://goa.domain)\n  - federation of minion groups?\n\nPlease comment on any issues or PRs related to these proposals.\nIf you don't see an issue, PR, or idea; definitely add it!\n\n\n### Installation\n\n```shell\ngo get -u github.com/verdverm/frisby\n```\n\n### Basic Usage\n\nFirst create a Frisby object:\n\n```go\n// create an object with a given name (used in the report)\nF := frisby.Create(\"Test successful user login\").\n    Get(\"https://golang.org\")\n```\n\nAdd any pre-flight data\n\n```go\nF.SetHeader(\"Content-Type\": \"application/json\").\n\tSetHeader(\"Accept\", \"application/json, text/plain, */*\").\n\tSetJson([]string{\"item1\", \"item2\", \"item3\"})\n```\n\nThere is also a Global object for setting repeated Pre-flight options.\n\n```go\nfrisby.Global.BasicAuth(\"username\", \"password\").\n\tSetHeader(\"Authorization\", \"Bearer \" + TOKEN)\n```\n\nNext send the request:\n\n```go\nF.Send()\n```\n\nThen assert and inspect the response:\n\n```go\nF.ExpectStatus(200).\n    ExpectJson(\"nested.path.to.value\", \"sometext\").\n    ExpectJson(\"nested.path.to.object\", golangObject).\n    ExpectJson(\"nested.array.7.id\", 23).\n    ExpectJsonLength(\"nested.array\", 8).\n    AfterJson(func(F *frisby.Frisby, json *simplejson.Json, err error) {\n\t\tval, _ := json.Get(\"proxy\").String()\n\t\tfrisby.Global.SetProxy(val)\n\t})\n```\n\nFinally, print out a report of the tests\n\n```go\nfrisby.Global.PrintReport()\n```\n\nCheck any error(s), however the global report prints any that occured as well\n\n`err := F.Error()`\n\n```go\nerrs := F.Errors()\nfor _,e := range errs {\n\tfmt.Println(\"Error: \", e)\n}\n```\n\n\n### HTTP Method functions\n\nYour basic HTTP verbs:\n\n* Get(url string)\n* Post(url string)\n* Put(url string)\n* Patch(url string)\n* Delete(url string)\n* Head(url string)\n* Options(url string)\n\n### Pre-flight functions\n\nFunctions called before `Send()`\n\nYou can also set theses on the `frisby.Global` object for persisting state over multiple requests.\n\n( Most of these come from [github.com/mozillazg/request](https://github.com/mozillazg/request))\n\n* BasicAuth(username,password string)\n* Proxy(url string)\n* SetHeader(key,value string)\n* SetHeaders(map[string]string)\n* SetCookies(key,value string)\n* SetCookiess(map[string]string)\n* SetDate(key,value string)\n* SetDates(map[string]string)\n* SetParam(key,value string)\n* SetParams(map[string]string)\n* SetJson(interface{})\n* SetFile(filename string)\n\n\n### Post-flight functions\n\nFunctions called after `Send()`\n\n* ExpectStatus(code int)\n* ExpectHeader(key, value string)\n* ExpectContent(content string)\n* ExpectJson(path string, value interface{})\n* ExpectJsonLength(path string, length int)\n* ExpectJsonType(path string, value_type reflect.Kind)\n* AfterContent( func(Frisby,[]byte,error) )\n* AfterText( func(Frisby,string,error) )\n* AfterJson( func(Frisby,simplejson.Json,error) )\n* PauseTest(t time.Duration)\n* PrintBody()\n* PrintReport()\n* PrintGoTestReport()\n\n\n### More examples\n\nYou can find a longer example [here](https://github.com/verdverm/pomopomo/tree/master/test/api)\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\n\t\"github.com/bitly/go-simplejson\"\n\t\"github.com/verdverm/frisby\"\n)\n\nfunc main() {\n\tfmt.Println(\"Frisby!\\n\")\n\n\tfrisby.Create(\"Test GET Go homepage\").\n\t\tGet(\"http://golang.org\").\n\t\tSend().\n\t\tExpectStatus(200).\n\t\tExpectContent(\"The Go Programming Language\")\n\n\tfrisby.Create(\"Test GET Go homepage (which fails)\").\n\t\tGet(\"http://golang.org\").\n\t\tSend().\n\t\tExpectStatus(400).\n\t\tExpectContent(\"A string which won't be found\")\n\n\tfrisby.Create(\"Test POST\").\n\t\tPost(\"http://httpbin.org/post\").\n\t\tSetData(\"test_key\", \"test_value\").\n\t\tSend().\n\t\tExpectStatus(200)\n\n\tfrisby.Create(\"Test ExpectJsonType\").\n\t\tPost(\"http://httpbin.org/post\").\n\t\tSend().\n\t\tExpectStatus(200).\n\t\tExpectJsonType(\"url\", reflect.String)\n\n\tfrisby.Create(\"Test ExpectJson\").\n\t\tPost(\"http://httpbin.org/post\").\n\t\tSend().\n\t\tExpectStatus(200).\n\t\tExpectJson(\"url\", \"http://httpbin.org/post\").\n\t\tExpectJson(\"headers.Accept\", \"*/*\")\n\n\tfrisby.Create(\"Test ExpectJsonLength (which fails)\").\n\t\tPost(\"http://httpbin.org/post\").\n\t\tSetJson([]string{\"item1\", \"item2\", \"item3\"}).\n\t\tSend().\n\t\tExpectStatus(200).\n\t\tExpectJsonLength(\"json\", 4)\n\n\tfrisby.Create(\"Test AfterJson\").\n\t\tPost(\"http://httpbin.org/post\").\n\t\tSend().\n\t\tExpectStatus(200).\n\t\tAfterJson(func(F *frisby.Frisby, json *simplejson.Json, err error) {\n\t\tval, _ := json.Get(\"url\").String()\n\t\tfrisby.Global.SetProxy(val)\n\t})\n\n\tfrisby.Global.PrintReport()\n}\n\n```\n\nSample Output\n\n```\nFrisby!\n\n.......\nFor 7 requests made\n  FAILED  [3/13]\n      [Test ExpectJsonLength]\n        -  Expect length to be 4, but got 3\n      [Test GET Go homepage (which fails)]\n        -  Expected Status 400, but got 200: \"200 OK\"\n        -  Expected Body to contain \"A string which won't be found\", but it was missing\n```\n\n![catch!](https://raw.github.com/verdverm/frisby/master/frisby.gif)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhofstadter-io%2Ffrisby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhofstadter-io%2Ffrisby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhofstadter-io%2Ffrisby/lists"}