{"id":13413861,"url":"https://github.com/fulldump/biff","last_synced_at":"2025-12-30T04:04:58.399Z","repository":{"id":48707492,"uuid":"127182646","full_name":"fulldump/biff","owner":"fulldump","description":"Bifurcation Framework for testing and use cases","archived":false,"fork":false,"pushed_at":"2023-01-11T00:32:50.000Z","size":487,"stargazers_count":14,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-07-31T20:52:56.377Z","etag":null,"topics":[],"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/fulldump.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["fulldump"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2018-03-28T18:35:53.000Z","updated_at":"2024-02-05T00:11:24.000Z","dependencies_parsed_at":"2023-02-08T21:00:58.614Z","dependency_job_id":null,"html_url":"https://github.com/fulldump/biff","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fulldump%2Fbiff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fulldump%2Fbiff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fulldump%2Fbiff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fulldump%2Fbiff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fulldump","download_url":"https://codeload.github.com/fulldump/biff/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221504043,"owners_count":16833941,"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-07-30T20:01:51.419Z","updated_at":"2025-12-30T04:04:58.384Z","avatar_url":"https://github.com/fulldump.png","language":"Go","readme":"\u003cimg src=\"logo.png\"\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://travis-ci.org/fulldump/biff\"\u003e\u003cimg src=\"https://travis-ci.org/fulldump/biff.svg?branch=master\"\u003e\u003c/a\u003e\n\u003ca href=\"https://cover.run/go?tag=golang-1.10\u0026repo=github.com%2Ffulldump%2Fbiff\"\u003e\u003cimg src=\"https://cover.run/go/github.com/fulldump/biff.svg?style=flat\u0026tag=golang-1.10\" alt=\"coverage badge\"\u003e\u003c/a\u003e\n\u003ca href=\"https://goreportcard.com/report/fulldump/biff\"\u003e\u003cimg src=\"http://goreportcard.com/badge/fulldump/biff\"\u003e\u003c/a\u003e\n\u003ca href=\"https://godoc.org/github.com/fulldump/biff\"\u003e\u003cimg src=\"https://godoc.org/github.com/fulldump/biff?status.svg\" alt=\"GoDoc\"\u003e\u003c/a\u003e\n\u003ca href=\"https://codeclimate.com/github/fulldump/biff/maintainability\"\u003e\u003cimg src=\"https://api.codeclimate.com/v1/badges/1b34e1fe8a1ab355b044/maintainability\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\nBiff stands for BIFurcation Framework based on nesting cases or alternatives. You can take advantage of variable scoping to make your tests simpler and easier to read. Good choice for acceptance and use cases testing, it provides a BBD style exit.\n\n\n\u003c!-- MarkdownTOC autolink=true bracket=round --\u003e\n\n- [Getting started](#getting-started)\n- [Get into the buggy line](#get-into-the-buggy-line)\n- [Isolated use cases](#isolated-use-cases)\n- [BDD on the fly](#bdd-on-the-fly)\n- [Take advantage of go function scope](#take-advantage-of-go-function-scope)\n- [Supported assertions](#supported-assertions)\n- [Contribute](#contribute)\n- [Testing](#testing)\n- [Example project](#example-project)\n\n\u003c!-- /MarkdownTOC --\u003e\n\n\n\n\n## Getting started\n\n```go\nbiff.Alternative(\"Instance service\", func(a *biff.A) {\n\n\ts := NewMyService()\n\n\ta.Alternative(\"Register user\", func(a *biff.A) {\n\n\t\tjohn := s.RegisterUser(\"john@email.com\", \"john-123\")\n\t\ta.AssertNotNil(john)\n\n\t\ta.Alternative(\"Bad credentials\", func(a *biff.A) {\n\t\t\tuser := s.Login(john.Email, \"bad-password\")\n\t\t\ta.AssertNil(user)\n\n\t\t}).Alternative(\"Login\", func(a *biff.A) {\n\t\t\tuser := s.Login(john.Email, john.Password)\n\t\t\ta.AssertEqual(user, john)\n\t\t})\n\n\t})\n})\n```\n\nOutput:\n\n```\n=== RUN   TestExample\nCase: Instance service\nCase: Register user\n    john is \u0026example.User{Email:\"john@email.com\", Password:\"john-123\"}\nCase: Bad credentials\n    user is \u003cnil\u003e\n-------------------------------\nCase: Instance service\nCase: Register user\n    john is \u0026example.User{Email:\"john@email.com\", Password:\"john-123\"}\nCase: Login\n    user is \u0026example.User{Email:\"john@email.com\", Password:\"john-123\"}\n-------------------------------\nCase: Instance service\nCase: Register user\n    john is \u0026example.User{Email:\"john@email.com\", Password:\"john-123\"}\n-------------------------------\nCase: Instance service\n-------------------------------\n--- PASS: TestExample (0.00s)\nPASS\n```\n\n## Get into the buggy line\n\nIn case of error, Biff will print something like this:\n\n```\nCase: Instance service\nCase: Register user\n    john is \u0026example.User{Email:\"john@email.com\", Password:\"john-123\"}\nCase: Login\n    Expected: \u0026example.User{Email:\"maria@email.com\", Password:\"1234\"}\n    Obtained: \u0026example.User{Email:\"john@email.com\", Password:\"john-123\"}\n    at biff/example.TestExample.func1.1.2(0xc420096ac0\n    /home/fulldump/workspace/my-project/src/example/users_test.go:84 +0x12\n```\n\nNavigating directly to the line where the fail was produced.\n\n\n## Isolated use cases\n\nAll possible bifurcations are tested in an isolated way.\n\n\n## BDD on the fly\n\nYou do not need to translate your tests behaviour to natural language. Biff will navigate through the execution stack and will parse portions of your testing code to pretty print your assertions.\n\nThis testing code:\n\n```go\na.AssertEqual(user, john)\n```\n\nwill be printed as:\n\n```\n    user is \u0026example.User{Email:\"john@email.com\", Password:\"john-123\"}\n```\n\n\n## Take advantage of go function scope\n\nAvoid testing helpers and auxiliar methods to maintain the status between tests,\ntake advantage of language varialbe scope itself to write powerful tests easy to write\nand easy to read.\n\n\n## Supported assertions\n\nMost commonly used assertions are implemented:\n\n* `AssertEqual`\n* `AssertEqualJson`\n* `AssertNil`\n* `AssertNotNil`\n* `AssertNotEqual`\n* `AssertInArray`\n* `AssertTrue`\n* `AssertFalse`\n\n\n## Contribute\n\nFeel free to fork, make changes and pull-request to master branch.\n\nIf you prefer, [create a new issue](https://github.com/fulldump/biff/issues/new) or email me for new features, issues or whatever.\n\n\n## Testing\n\nWho will test the tester? ha ha\n\nThere are no tests for the moment but there will be, sooner than later.\n\n\n## Example project\n\nThis project includes an example project with some naive business logic plus some Biff tests.\n\n","funding_links":["https://github.com/sponsors/fulldump"],"categories":["Testing","测试","Testing Frameworks","Template Engines","测试相关","测试相关`测试库和测试数据集生成库`"],"sub_categories":["Testing Frameworks","HTTP Clients","Advanced Console UIs","HTTP客户端","交流","查询语"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffulldump%2Fbiff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffulldump%2Fbiff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffulldump%2Fbiff/lists"}