{"id":18324089,"url":"https://github.com/manveru/gobdd","last_synced_at":"2025-04-06T00:30:54.482Z","repository":{"id":2607809,"uuid":"3591197","full_name":"manveru/gobdd","owner":"manveru","description":"BDD in Go","archived":false,"fork":false,"pushed_at":"2013-12-10T09:25:15.000Z","size":110,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-21T13:52:39.037Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://degutis.org","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/manveru.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-03-01T11:00:45.000Z","updated_at":"2023-12-24T15:41:33.000Z","dependencies_parsed_at":"2022-07-09T08:30:24.196Z","dependency_job_id":null,"html_url":"https://github.com/manveru/gobdd","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/manveru%2Fgobdd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manveru%2Fgobdd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manveru%2Fgobdd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manveru%2Fgobdd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manveru","download_url":"https://codeload.github.com/manveru/gobdd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247419597,"owners_count":20936009,"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":[],"created_at":"2024-11-05T18:31:47.360Z","updated_at":"2025-04-06T00:30:53.710Z","avatar_url":"https://github.com/manveru.png","language":"Go","readme":"# BDD testing for Go\n\nIt's pretty cool.\n\n## Installation\n\n\tmake test # assurance that it works\n\tmake install # installs to your $GOROOT\n\n## Usage\n\nCreate a gotest-style file (ie, *_test.go) containing the following:\n\n\tpackage my_cool_app\n\t\n\timport . \"gobdd\"\n\n\tfunc init() {\n\t  defer PrintSpecReport()\n  \n\t  type MyGreatTestType struct {\n\t    Name string\n\t    Age int\n\t  }\n  \n\t  MyNil := func() *MyGreatTestType {\n\t    return nil\n\t  }\n  \n\t  MyNonNil := func() *MyGreatTestType {\n\t    return \u0026MyGreatTestType{}\n\t  }\n  \n\t  var anObject *MyGreatTestType\n  \n\t  Describe(\"matchers\", func() {\n    \n\t    BeforeEach(func() {\n\t      // this is run at this level and every describe within it, however deeply nested\n\t      anObject = new(MyGreatTestType)\n\t      anObject.Name = \"john\"\n\t      anObject.Age = 23\n\t    })\n    \n\t    Describe(\"not equals\", func() {\n      \n\t      It(\"matches on simple objects\", func() {\n\t        Expect(\u0026MyGreatTestType{\"john\", 23}, ToNotEqual, anObject)\n\t        Expect(\"foo\", ToEqual, \"foo\")\n\t        Expect(\"foo\", ToNotEqual, \"bar\")\n\t      })\n      \n\t      It(\"matches for typed-nil\", func() {\n\t        Expect(MyNil(), ToBeNil)\n\t        Expect(MyNonNil(), ToNotBeNil)\n\t      })\n      \n\t      It(\"matches for nil\", func() {\n\t        Expect(nil, ToBeNil)\n\t        Expect(true, ToNotBeNil)\n\t      })\n      \n\t    })\n    \n\t    Describe(\"deep equals matcher\", func() {\n      \n\t      It(\"matches what equals does not\", func() {\n\t        Expect(\u0026MyGreatTestType{\"john\", 23}, ToDeepEqual, anObject)\n\t        Expect(\"foo\", ToDeepEqual, \"foo\")\n\t      })\n      \n\t    })\n    \n\t    Describe(\"exception-rescuing matchers\", func() {\n      \n\t      It(\"is super cool\", func() {\n\t        Expect(func() { panic(\"foobar!\") }, ToPanicWith, \"foobar!\")\n\t        Expect(func() {}, ToNotPanic)\n\t      })\n      \n\t    })\n    \n\t  })\n\t}\n\nNext, add the following lines to *only one* of your *_test.go files:\n\n\timport \"testing\"\n\tfunc TestEverything(t *testing.T) {}\n\nThen, to run the tests, use either of these:\n\n\tmake test\n\tgotest\n\n(It's just the same as running tests using the built-in testing framework.)\n\n## Writing your own matchers\n\n\tfunc ToBeTruthy(obj interface{}) (string, bool) {\n\t  if obj != true {\n\t    return fmt.Sprintf(\n\t\t\t\"expected: true\\n\"+\n\t\t\t\"     got: %v\\n\", obj), false\n\t  }\n\t  return \"\", true\n\t}\n\nYour custom matchers may take any number of arguments of any type your heart so desires. For example:\n\n\tfunc ToBeInside(obj interface{}, array []string) (string, bool) {\n\t  found := false\n  \n\t  for _, v := range array {\n\t    if obj == v { found = true }\n\t  }\n  \n\t  if !found {\n\t    return fmt.Sprintf(\n\t\t\t\"expected to find: %v\\n\"+\n\t\t\t\"        in array: %v\\n\", obj, array), false\n\t  }\n\t  return \"\", true\n\t}\n\nwill then work with `Expect(\"foo\", ToBeInside, []string{\"foo\"})`\n\n## License\n\nPublic domain\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanveru%2Fgobdd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanveru%2Fgobdd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanveru%2Fgobdd/lists"}