{"id":28385621,"url":"https://github.com/smoothprogrammer/gostman","last_synced_at":"2026-01-12T06:04:38.443Z","repository":{"id":57639474,"uuid":"379234716","full_name":"smoothprogrammer/gostman","owner":"smoothprogrammer","description":"Postman nuances in Go Test","archived":false,"fork":false,"pushed_at":"2025-05-28T16:00:29.000Z","size":34,"stargazers_count":13,"open_issues_count":4,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-08-10T03:35:26.675Z","etag":null,"topics":["api","api-development","go","gostman","postman","testing"],"latest_commit_sha":null,"homepage":"","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/smoothprogrammer.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-06-22T10:47:23.000Z","updated_at":"2025-05-28T16:00:33.000Z","dependencies_parsed_at":"2024-06-19T16:24:35.187Z","dependency_job_id":"12cb90d5-ed67-4d81-bde0-2411b8627215","html_url":"https://github.com/smoothprogrammer/gostman","commit_stats":{"total_commits":30,"total_committers":1,"mean_commits":30.0,"dds":0.0,"last_synced_commit":"765d5605808abd6c13e294e434b1aa59097ee633"},"previous_names":["bigzilla/gostman","injustease/gostman","smoothprogrammer/gostman","minizilla/gostman"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/smoothprogrammer/gostman","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smoothprogrammer%2Fgostman","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smoothprogrammer%2Fgostman/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smoothprogrammer%2Fgostman/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smoothprogrammer%2Fgostman/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smoothprogrammer","download_url":"https://codeload.github.com/smoothprogrammer/gostman/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smoothprogrammer%2Fgostman/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28336119,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T00:36:25.062Z","status":"online","status_checked_at":"2026-01-12T02:00:08.677Z","response_time":98,"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":["api","api-development","go","gostman","postman","testing"],"created_at":"2025-05-30T11:12:02.945Z","updated_at":"2026-01-12T06:04:38.436Z","avatar_url":"https://github.com/smoothprogrammer.png","language":"Go","readme":"# gostman [![Go Reference](https://pkg.go.dev/badge/github.com/smoothprogrammer/gostman.svg)](https://pkg.go.dev/github.com/smoothprogrammer/gostman) [![main](https://github.com/smoothprogrammer/gostman/actions/workflows/main.yaml/badge.svg)](https://github.com/smoothprogrammer/gostman/actions/workflows/main.yaml)\n\n[Postman](https://www.postman.com/) nuances in [Go](https://golang.org/) Test.\n\n## Install\n\nJust import gostman to your test package.\n\n```go\nimport github.com/smoothprogrammer/gostman\n```\n\n## Usage\n\nAlways run the runtime in the `TestMain`.\n\n```go\nfunc TestMain(m *testing.M) {\n    os.Exit(gostman.Run(m))\n}\n```\n\n*Optional*. Create gostman environment file `.gostman.env.yml` if using variable.\n\n```yml\nmyenv:\n  var1: \"variable 1\"\n  var2: \"variable 2\"\nanother_env:\n  var1: \"another variable 1\"\n  var2: \"another variable 2\"\n```\n\nCreate usual Test function `TestXxx`.\n\n```go\nfunc TestRequest(t *testing.T) {\n    gm := gostman.New(t)\n\n    // every request run in the subtests\n    gm.GET(\"Request\", \"url\", func(r *gostman.Request) {\n        // just code usual go code for Pre-request Script\n\n        value := gm.V(\"var1\") // get variable\n        gm.SetV(\"var2\", value) // set variable\n\n        r.Params( /*sets Params here*/ )\n\n        r.Authorization( /*sets Authorization here*/ )\n\n        r.Headers( /*sets Headers here*/ )\n\n        r.Body( /*sets Body here*/ )\n\n        r.Send( /*send the request and tests the result here*/ )\n    })\n\n    // create another request\n    gm.POST(\"Another Request\", \"url\", func(r *gostman.Request) {})\n```\n\nLeverage `go test` command to run the above requests.\n\n```sh\ngo test # run all gostman requests in the package\ngo test -run Request # run all collection in the TestRequest\ngo test -run Request/AnotherRequest # run only AnotherRequest\ngo test -run Request -env myenv # run request and use \"myenv\" environment\ngo test -run Request -setenv myenv # run request, use \"myenv\" environment and set it for the future request\n```\n\n## The Runtime\n\nGostman generate file `.gostman.runtime.yml` to store runtime config and variable and change often after each request.\nIt is **recommended** to ignore it in the `.gitignore`.\n\n```gitignore\n*.gostman.runtime.yml\n```\n\n## Flags\n\n- All `go test` flags\n- `-env {env}` Select environment define in `.gostman.env.yml`\n- `-setenv {env}` Select environment define in `.gostman.env.yml` and set it for the future request\n- `-reset` Reset `.gostman.runtime.yml`\n- `-debug` Run gostman in debug mode\n\n## Example\n\nMore in the examples folder.\n\n```go\npackage gostman_test\n\nimport (\n    \"encoding/json\"\n    \"net/http\"\n    \"net/url\"\n    \"os\"\n    \"testing\"\n\n    \"github.com/smoothprogrammer/gostman\"\n    \"github.com/smoothprogrammer/testr\"\n)\n\nfunc TestMain(m *testing.M) {\n    os.Exit(gostman.Run(m))\n}\n\nfunc TestRequest(t *testing.T) {\n    gm := gostman.New(t)\n\n    gm.GET(\"Params\", \"https://postman-echo.com/get\", func(r *gostman.Request) {\n        r.Params(func(v url.Values) {\n            v.Set(\"foo\", \"bar\")\n        })\n\n        r.Send(func(t *testing.T, req *http.Request, res *http.Response) {\n            defer res.Body.Close()\n\n            assert := testr.New(t)\n            assert.Equal(res.StatusCode, http.StatusOK)\n\n            var resp = struct {\n                Args map[string]string `json:\"args\"`\n            }{}\n            err := json.NewDecoder(res.Body).Decode(\u0026resp)\n            assert.ErrorIs(err, nil)\n            assert.Equal(resp.Args[\"foo\"], \"bar\")\n        })\n    })\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmoothprogrammer%2Fgostman","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmoothprogrammer%2Fgostman","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmoothprogrammer%2Fgostman/lists"}