{"id":1992345,"url":"https://onsi.github.io/ginkGo","last_synced_at":"2025-03-14T01:32:00.296Z","repository":{"id":10231205,"uuid":"12332444","full_name":"onsi/ginkgo","owner":"onsi","description":"A Modern Testing Framework for Go","archived":false,"fork":false,"pushed_at":"2024-09-25T01:15:49.000Z","size":7359,"stargazers_count":8320,"open_issues_count":105,"forks_count":657,"subscribers_count":100,"default_branch":"master","last_synced_at":"2024-10-19T16:55:07.452Z","etag":null,"topics":["bdd","bdd-framework","go","golang","test","test-driven-development","testing"],"latest_commit_sha":null,"homepage":"http://onsi.github.io/ginkgo/","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/onsi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","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},"funding":{"github":["onsi"]}},"created_at":"2013-08-23T20:53:05.000Z","updated_at":"2024-10-19T00:08:38.000Z","dependencies_parsed_at":"2023-11-29T03:38:03.430Z","dependency_job_id":"24e962c2-bae6-4895-b69f-b0fba502c002","html_url":"https://github.com/onsi/ginkgo","commit_stats":{"total_commits":1175,"total_committers":221,"mean_commits":5.316742081447964,"dds":0.6408510638297873,"last_synced_commit":"104752fa2e97f04b1300754e710c419a63d2d30c"},"previous_names":[],"tags_count":88,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onsi%2Fginkgo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onsi%2Fginkgo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onsi%2Fginkgo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onsi%2Fginkgo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/onsi","download_url":"https://codeload.github.com/onsi/ginkgo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221428872,"owners_count":16819241,"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":["bdd","bdd-framework","go","golang","test","test-driven-development","testing"],"created_at":"2024-01-20T15:47:05.773Z","updated_at":"2025-03-14T01:32:00.286Z","avatar_url":"https://github.com/onsi.png","language":"Go","readme":"![Ginkgo](https://onsi.github.io/ginkgo/images/ginkgo.png)\n\n[![test](https://github.com/onsi/ginkgo/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/onsi/ginkgo/actions?query=workflow%3Atest+branch%3Amaster) | [Ginkgo Docs](https://onsi.github.io/ginkgo/)\n\n---\n\n# Ginkgo\n\nGinkgo is a mature testing framework for Go designed to help you write expressive specs.  Ginkgo builds on top of Go's `testing` foundation and is complemented by the [Gomega](https://github.com/onsi/gomega) matcher library.  Together, Ginkgo and Gomega let you express the intent behind your specs clearly:\n\n```go\nimport (\n    . \"github.com/onsi/ginkgo/v2\"\n    . \"github.com/onsi/gomega\"\n    ...\n)\n\nvar _ = Describe(\"Checking books out of the library\", Label(\"library\"), func() {\n    var library *libraries.Library\n    var book *books.Book\n    var valjean *users.User\n    BeforeEach(func() {\n        library = libraries.NewClient()\n        book = \u0026books.Book{\n            Title: \"Les Miserables\",\n            Author: \"Victor Hugo\",\n        }\n        valjean = users.NewUser(\"Jean Valjean\")\n    })\n\n    When(\"the library has the book in question\", func() {\n        BeforeEach(func(ctx SpecContext) {\n            Expect(library.Store(ctx, book)).To(Succeed())\n        })\n\n        Context(\"and the book is available\", func() {\n            It(\"lends it to the reader\", func(ctx SpecContext) {\n                Expect(valjean.Checkout(ctx, library, \"Les Miserables\")).To(Succeed())\n                Expect(valjean.Books()).To(ContainElement(book))\n                Expect(library.UserWithBook(ctx, book)).To(Equal(valjean))\n            }, SpecTimeout(time.Second * 5))\n        })\n\n        Context(\"but the book has already been checked out\", func() {\n            var javert *users.User\n            BeforeEach(func(ctx SpecContext) {\n                javert = users.NewUser(\"Javert\")\n                Expect(javert.Checkout(ctx, library, \"Les Miserables\")).To(Succeed())\n            })\n\n            It(\"tells the user\", func(ctx SpecContext) {\n                err := valjean.Checkout(ctx, library, \"Les Miserables\")\n                Expect(err).To(MatchError(\"Les Miserables is currently checked out\"))\n            }, SpecTimeout(time.Second * 5))\n\n            It(\"lets the user place a hold and get notified later\", func(ctx SpecContext) {\n                Expect(valjean.Hold(ctx, library, \"Les Miserables\")).To(Succeed())\n                Expect(valjean.Holds(ctx)).To(ContainElement(book))\n\n                By(\"when Javert returns the book\")\n                Expect(javert.Return(ctx, library, book)).To(Succeed())\n\n                By(\"it eventually informs Valjean\")\n                notification := \"Les Miserables is ready for pick up\"\n                Eventually(ctx, valjean.Notifications).Should(ContainElement(notification))\n\n                Expect(valjean.Checkout(ctx, library, \"Les Miserables\")).To(Succeed())\n                Expect(valjean.Books(ctx)).To(ContainElement(book))\n                Expect(valjean.Holds(ctx)).To(BeEmpty())\n            }, SpecTimeout(time.Second * 10))\n        })  \n    })\n\n    When(\"the library does not have the book in question\", func() {\n        It(\"tells the reader the book is unavailable\", func(ctx SpecContext) {\n            err := valjean.Checkout(ctx, library, \"Les Miserables\")\n            Expect(err).To(MatchError(\"Les Miserables is not in the library catalog\"))\n        }, SpecTimeout(time.Second * 5))\n    })\n})\n```\n\nJump to the [docs](https://onsi.github.io/ginkgo/) to learn more.  It's easy to [bootstrap](https://onsi.github.io/ginkgo/#bootstrapping-a-suite) and start writing your [first specs](https://onsi.github.io/ginkgo/#adding-specs-to-a-suite).\n\nIf you have a question, comment, bug report, feature request, etc. please open a [GitHub issue](https://github.com/onsi/ginkgo/issues/new), or visit the [Ginkgo Slack channel](https://app.slack.com/client/T029RQSE6/CQQ50BBNW).\n\n## Capabilities\n\nWhether writing basic unit specs, complex integration specs, or even performance specs - Ginkgo gives you an expressive Domain-Specific Language (DSL) that will be familiar to users coming from frameworks such as [Quick](https://github.com/Quick/Quick), [RSpec](https://rspec.info), [Jasmine](https://jasmine.github.io), and [Busted](https://lunarmodules.github.io/busted/).  This style of testing is sometimes referred to as \"Behavior-Driven Development\" (BDD) though Ginkgo's utility extends beyond acceptance-level testing.\n\nWith Ginkgo's DSL you can use nestable [`Describe`, `Context` and `When` container nodes](https://onsi.github.io/ginkgo/#organizing-specs-with-container-nodes) to help you organize your specs.  [`BeforeEach` and `AfterEach` setup nodes](https://onsi.github.io/ginkgo/#extracting-common-setup-beforeeach) for setup and cleanup.  [`It` and `Specify` subject nodes](https://onsi.github.io/ginkgo/#spec-subjects-it) that hold your assertions. [`BeforeSuite` and `AfterSuite` nodes](https://onsi.github.io/ginkgo/#suite-setup-and-cleanup-beforesuite-and-aftersuite) to prep for and cleanup after a suite... and [much more!](https://onsi.github.io/ginkgo/#writing-specs).\n\nAt runtime, Ginkgo can run your specs in reproducibly [random order](https://onsi.github.io/ginkgo/#spec-randomization) and has sophisticated support for [spec parallelization](https://onsi.github.io/ginkgo/#spec-parallelization).  In fact, running specs in parallel is as easy as\n\n```bash\nginkgo -p\n```\n\nBy following [established patterns for writing parallel specs](https://onsi.github.io/ginkgo/#patterns-for-parallel-integration-specs) you can build even large, complex integration suites that parallelize cleanly and run performantly.  And you don't have to worry about your spec suite hanging or leaving a mess behind - Ginkgo provides a per-node `context.Context` and the capability to interrupt the spec after a set period of time - and then clean up.\n\nAs your suites grow Ginkgo helps you keep your specs organized with [labels](https://onsi.github.io/ginkgo/#spec-labels) and lets you easily run [subsets of specs](https://onsi.github.io/ginkgo/#filtering-specs), either [programmatically](https://onsi.github.io/ginkgo/#focused-specs) or on the [command line](https://onsi.github.io/ginkgo/#combining-filters).  And Ginkgo's reporting infrastructure generates machine-readable output in a [variety of formats](https://onsi.github.io/ginkgo/#generating-machine-readable-reports) _and_ allows you to build your own [custom reporting infrastructure](https://onsi.github.io/ginkgo/#generating-reports-programmatically).\n\nGinkgo ships with `ginkgo`, a [command line tool](https://onsi.github.io/ginkgo/#ginkgo-cli-overview) with support for generating, running, filtering, and profiling Ginkgo suites.  You can even have Ginkgo automatically run your specs when it detects a change with `ginkgo watch`, enabling rapid feedback loops during test-driven development.\n\nAnd that's just Ginkgo!  [Gomega](https://onsi.github.io/gomega/) brings a rich, mature, family of [assertions and matchers](https://onsi.github.io/gomega/#provided-matchers) to your suites.  With Gomega you can easily mix [synchronous and asynchronous assertions](https://onsi.github.io/ginkgo/#patterns-for-asynchronous-testing) in your specs.  You can even build your own set of expressive domain-specific matchers quickly and easily by composing Gomega's [existing building blocks](https://onsi.github.io/ginkgo/#building-custom-matchers).\n\nHappy Testing!\n\n## License\n\nGinkgo is MIT-Licensed\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md)\n","funding_links":["https://github.com/sponsors/onsi"],"categories":["测试","測試"],"sub_categories":["高级控制台界面","高級控制台界面"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/onsi.github.io%2FginkGo","html_url":"https://awesome.ecosyste.ms/projects/onsi.github.io%2FginkGo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/onsi.github.io%2FginkGo/lists"}