{"id":20238121,"url":"https://github.com/basilfx/go-testwire","last_synced_at":"2026-06-07T17:33:06.120Z","repository":{"id":57544751,"uuid":"297061852","full_name":"basilfx/go-testwire","owner":"basilfx","description":"An easy-to-use API to add test automation probes","archived":false,"fork":false,"pushed_at":"2020-09-20T11:32:25.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-22T06:03:26.874Z","etag":null,"topics":["golang","golang-library","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/basilfx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-20T11:32:03.000Z","updated_at":"2020-09-20T11:32:54.000Z","dependencies_parsed_at":"2022-08-27T05:20:15.825Z","dependency_job_id":null,"html_url":"https://github.com/basilfx/go-testwire","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basilfx%2Fgo-testwire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basilfx%2Fgo-testwire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basilfx%2Fgo-testwire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basilfx%2Fgo-testwire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/basilfx","download_url":"https://codeload.github.com/basilfx/go-testwire/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241685491,"owners_count":20003101,"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":["golang","golang-library","testing"],"created_at":"2024-11-14T08:31:40.690Z","updated_at":"2026-06-07T17:33:06.037Z","avatar_url":"https://github.com/basilfx.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-testwire\nAn easy-to-use API to add test automation probes.\n\n## Introduction\nThis library provides an easy-to-use API to add test probes to your code. These\nprobes can be used to retrieve information of your application that is normally\nnot exposed.\n\nThis can be used to assert certain conditions in your applications that would\notherwise be hard to assert while performing automated tests (black-box tests).\n\n## Use case\nWhen testing an API, you can perform a request, and maybe another one to assert\na condition. But if you are working with hardware, it might be valueable to\nassert that an API request perfoms a certain hardware action on the lower\nlevel.\n\nA test scenario could look like this:\n\n```gherkin\nGiven a running system\nWhen I start the motor via the API\nThen the response is successful\nAnd the hardware turns on the power of the motor\n```\n\nThis library may be useful to provide an implementation of the last step: it is\ninformation that is typically not exposed via an API. By probing into the\ncommunication layer with the hardware, we can now use this library to observe\nthe 'internals'.\n\n## Usage\nYou need to explicitly enable TestWire support by compiling your application\nwith the `testwire` tag set, e.g. `go build -tags testwire main.go`.\n\nWithout this tag, a 'disabled' version of testwire is compiled that provides\nstubs.\n\n### Adding probes and signals\nProbes retrieve information, signals perform actions. They both assume that\ndata can be returned as a string.\n\nTo add a probe, add the following:\n\n```go\ntestwire.AddProbe(\"probe.name\", func() string {\n    return \"Foo\"\n})\n```\n\nTo add a signal, add the following:\n\n```go\ntestwire.AddSignal(\"signal.name\", func(s string) {\n    log.Printf(\"Signal data: %s\", s)\n})\n```\n\n### Serving\nTo start serving, simply add:\n\n```go\ngo testwire.Serve(port number)\n\n```\n\n### API\nProbes are exposed on `http://localhost:9000/probes/probe.name`. A GET request\nreturns the probe value. Signals can be invoked by performing a POST request to\n`http://localhost:9000/signals/signal.name`.\n\n## License\nSee the [`LICENSE.md`](LICENSE.md) file (MIT license).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasilfx%2Fgo-testwire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbasilfx%2Fgo-testwire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasilfx%2Fgo-testwire/lists"}